Make sure that custom field format cannot be changed.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10624 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-10-13 07:40:07 +00:00
parent e04bd297e0
commit 8a6ce3a646
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -53,6 +53,11 @@ class CustomField < ActiveRecord::Base
CUSTOM_FIELDS_NAMES = CUSTOM_FIELDS_TABS.collect{|v| v[:name]}
def field_format=(arg)
# cannot change format of a saved custom field
super if new_record?
end
def set_searchable
# make sure these fields are not searchable
self.searchable = false if %w(int float date bool).include?(field_format)