From 53680edb2d80777e6cbf2801cf2da468a7638d1f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 9 Mar 2013 10:59:22 +0000 Subject: [PATCH] Merged r11497 from trunk (#13329). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11574 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 3 ++- app/models/project.rb | 3 ++- app/models/user.rb | 3 ++- lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 36beed6c4..cc50637e0 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -184,11 +184,12 @@ class Issue < ActiveRecord::Base super end + alias :base_reload :reload def reload(*args) @workflow_rule_by_attribute = nil @assignable_versions = nil @relations = nil - super + base_reload(*args) end # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields diff --git a/app/models/project.rb b/app/models/project.rb index 4591d563c..49fa9dcde 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -285,6 +285,7 @@ class Project < ActiveRecord::Base self.find(*args) end + alias :base_reload :reload def reload(*args) @shared_versions = nil @rolled_up_versions = nil @@ -297,7 +298,7 @@ class Project < ActiveRecord::Base @actions_allowed = nil @start_date = nil @due_date = nil - super + base_reload(*args) end def to_param diff --git a/app/models/user.rb b/app/models/user.rb index 81c74e52a..2bfbbd14e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -128,11 +128,12 @@ class User < Principal end end + alias :base_reload :reload def reload(*args) @name = nil @projects_by_role = nil @membership_by_project_id = nil - super + base_reload(*args) end def mail=(arg) diff --git a/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb b/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb index 28cefd4ef..1f1aa1e44 100644 --- a/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb +++ b/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb @@ -33,7 +33,6 @@ module Redmine :dependent => :delete_all, :validate => false - send :alias_method, :reload_without_custom_fields, :reload send :include, Redmine::Acts::Customizable::InstanceMethods validate :validate_custom_field_values after_save :save_custom_field_values @@ -43,6 +42,7 @@ module Redmine module InstanceMethods def self.included(base) base.extend ClassMethods + base.send :alias_method_chain, :reload, :custom_fields end def available_custom_fields @@ -154,7 +154,7 @@ module Redmine @custom_field_values_changed = true end - def reload(*args) + def reload_with_custom_fields(*args) @custom_field_values = nil @custom_field_values_changed = false reload_without_custom_fields(*args) -- 2.39.5