:order => "#{CustomField.table_name}.position",
: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
@custom_field_values_changed = true
end
+ def reload(*args)
+ @custom_field_values = nil
+ @custom_field_values_changed = false
+ reload_without_custom_fields(*args)
+ end
+
module ClassMethods
end
end
assert_equal 'MySQL', issue.custom_field_value(1)
end
+ def test_reload_should_reload_custom_field_values
+ issue = Issue.generate!
+ issue.custom_field_values = {'2' => 'Foo'}
+ issue.save!
+
+ issue = Issue.order('id desc').first
+ assert_equal 'Foo', issue.custom_field_value(2)
+
+ issue.custom_field_values = {'2' => 'Bar'}
+ assert_equal 'Bar', issue.custom_field_value(2)
+
+ issue.reload
+ assert_equal 'Foo', issue.custom_field_value(2)
+ end
+
def test_should_update_issue_with_disabled_tracker
p = Project.find(1)
issue = Issue.find(1)