OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
get attributes using method calls instead of attributes hash to allow "virtual" attributes
Ivan Kuchinaf0247249dc4
diff --git a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rbindex 3cb490eba91..28fbafffa35 100644--- a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb+++ b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb@@ -31,8 +31,8 @@module Acts::Journalized::Differclass Associationdef initialize(original, changed, association:, id_attribute:)- @original_by_id = attributes_by_id(original, association, id_attribute)- @changed_by_id = attributes_by_id(changed, association, id_attribute)+ @original_by_id = association_by_id(original, association, id_attribute)+ @changed_by_id = association_by_id(changed, association, id_attribute)@ids = (@changed_by_id.keys | @original_by_id.keys).compactend@@ -56,22 +56,20 @@ module Acts::Journalized::Differprivate- def attributes_by_id(model, association, id_attribute)+ def association_by_id(model, association, id_attribute)return {} unless model- id_attribute = id_attribute.to_s-relation = if association.respond_to?(:call)association.call(model)elsemodel.send(association)end- relation.map(&:attributes).group_by { _1[id_attribute] }+ relation.group_by(&id_attribute.to_sym)enddef single_attribute_changes(attribute)- attribute = attribute.to_s+ attribute = attribute.to_sympairs = @ids.index_with do |id|[@@ -85,7 +83,7 @@ module Acts::Journalized::Differdef combine_journals(journals, attribute)# TODO: is there real case where there will be more than one value?- journals.pluck(attribute).sort.join(",") if journals+ journals.map(&attribute).sort.join(",") if journalsendendend