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
Implement `to_hash` instead of `to_h` to allow for implicit type casting
Klaus Zanders96e574904fe7
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rbindex b002ad97548..c617afae04a 100644--- a/app/services/journals/create_service.rb+++ b/app/services/journals/create_service.rb@@ -870,7 +870,7 @@ module Journalsdef cause_sql(cause)# Using the same encoder mechanism that ActiveRecord uses for json/jsonb columns- ActiveSupport::JSON.encode(cause&.to_h || {})+ ActiveSupport::JSON.encode(cause || {})end# Because we added the journal via bare metal sql, rails does not yet@@ -906,7 +906,7 @@ module Journalsenddef same_cause?(predecessor, cause)- (predecessor.cause.blank? && cause.blank?) || predecessor.cause == cause.to_h+ (predecessor.cause.blank? && cause.blank?) || predecessor.cause == causeenddef log_journal_creation(predecessor)diff --git a/lib_static/plugins/acts_as_journalized/lib/cause_of_change/base.rb b/lib_static/plugins/acts_as_journalized/lib/cause_of_change/base.rbindex 40e1b610611..3be75e65a88 100644--- a/lib_static/plugins/acts_as_journalized/lib/cause_of_change/base.rb+++ b/lib_static/plugins/acts_as_journalized/lib/cause_of_change/base.rb@@ -35,7 +35,7 @@ module CauseOfChange@additional_attributes = additional_attributesend- def to_h+ def to_hash{ "type" => type }.merge(additional_attributes).deep_stringify_keysend@@ -44,13 +44,7 @@ module CauseOfChangeenddef ==(other)- if other.is_a?(Hash)- to_h == other- else- other.class == self.class &&- type == other.type &&- additional_attributes == other.additional_attributes- end+ to_hash == other.to_hashendendenddiff --git a/lib_static/plugins/acts_as_journalized/lib/cause_of_change/no_cause.rb b/lib_static/plugins/acts_as_journalized/lib/cause_of_change/no_cause.rbindex e79ded31956..8e65d5d82c1 100644--- a/lib_static/plugins/acts_as_journalized/lib/cause_of_change/no_cause.rb+++ b/lib_static/plugins/acts_as_journalized/lib/cause_of_change/no_cause.rb@@ -36,7 +36,7 @@ module CauseOfChangetrueend- def to_h+ def to_hash{}endend