@@ -32,6 +32,8 module Redmine | |||
|
32 | 32 | :order => "#{CustomField.table_name}.position", |
|
33 | 33 | :dependent => :delete_all, |
|
34 | 34 | :validate => false |
|
35 | ||
|
36 | send :alias_method, :reload_without_custom_fields, :reload | |
|
35 | 37 | send :include, Redmine::Acts::Customizable::InstanceMethods |
|
36 | 38 | validate :validate_custom_field_values |
|
37 | 39 | after_save :save_custom_field_values |
@@ -152,6 +154,12 module Redmine | |||
|
152 | 154 | @custom_field_values_changed = true |
|
153 | 155 | end |
|
154 | 156 | |
|
157 | def reload(*args) | |
|
158 | @custom_field_values = nil | |
|
159 | @custom_field_values_changed = false | |
|
160 | reload_without_custom_fields(*args) | |
|
161 | end | |
|
162 | ||
|
155 | 163 | module ClassMethods |
|
156 | 164 | end |
|
157 | 165 | end |
@@ -421,6 +421,21 class IssueTest < ActiveSupport::TestCase | |||
|
421 | 421 | assert_equal 'MySQL', issue.custom_field_value(1) |
|
422 | 422 | end |
|
423 | 423 | |
|
424 | def test_reload_should_reload_custom_field_values | |
|
425 | issue = Issue.generate! | |
|
426 | issue.custom_field_values = {'2' => 'Foo'} | |
|
427 | issue.save! | |
|
428 | ||
|
429 | issue = Issue.order('id desc').first | |
|
430 | assert_equal 'Foo', issue.custom_field_value(2) | |
|
431 | ||
|
432 | issue.custom_field_values = {'2' => 'Bar'} | |
|
433 | assert_equal 'Bar', issue.custom_field_value(2) | |
|
434 | ||
|
435 | issue.reload | |
|
436 | assert_equal 'Foo', issue.custom_field_value(2) | |
|
437 | end | |
|
438 | ||
|
424 | 439 | def test_should_update_issue_with_disabled_tracker |
|
425 | 440 | p = Project.find(1) |
|
426 | 441 | issue = Issue.find(1) |
General Comments 0
You need to be logged in to leave comments.
Login now