Defect #9737 » save_custom_values_after_customized_is_saved.diff
| vendor/plugins/acts_as_customizable/lib/acts_as_customizable.rb (working copy) | ||
|---|---|---|
| 1 |
# redMine - project management software
|
|
| 2 |
# Copyright (C) 2006-2008 Jean-Philippe Lang
|
|
| 1 |
# Redmine - project management software
|
|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| ... | ... | |
| 74 | 74 |
end |
| 75 | 75 |
|
| 76 | 76 |
def custom_field_values |
| 77 |
@custom_field_values ||= available_custom_fields.collect { |x| custom_values.detect { |v| v.custom_field == x } || custom_values.build(:custom_field => x, :value => nil) }
|
|
| 77 |
@custom_field_values ||= available_custom_fields.collect { |x| custom_values.detect { |v| v.custom_field == x } || custom_values.build(:customized => self, :custom_field => x, :value => nil) }
|
|
| 78 | 78 |
end |
| 79 | 79 |
|
| 80 | 80 |
def visible_custom_field_values |
| ... | ... | |
| 94 | 94 |
custom_field_values.each(&:save) |
| 95 | 95 |
@custom_field_values_changed = false |
| 96 | 96 |
@custom_field_values = nil |
| 97 |
self.custom_values = custom_field_values |
|
| 97 | 98 |
end |
| 98 | 99 |
|
| 99 | 100 |
def reset_custom_values! |