Rails3: model: replace deprecated before_validation method at CustomField model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8191 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4f8ed70813
commit
f1994ea9c0
|
@ -28,13 +28,14 @@ class CustomField < ActiveRecord::Base
|
||||||
validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
|
validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
|
||||||
|
|
||||||
validate :validate_values
|
validate :validate_values
|
||||||
|
before_validation :set_searchable
|
||||||
|
|
||||||
def initialize(attributes = nil)
|
def initialize(attributes = nil)
|
||||||
super
|
super
|
||||||
self.possible_values ||= []
|
self.possible_values ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_validation
|
def set_searchable
|
||||||
# make sure these fields are not searchable
|
# make sure these fields are not searchable
|
||||||
self.searchable = false if %w(int float date bool).include?(field_format)
|
self.searchable = false if %w(int float date bool).include?(field_format)
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in New Issue