##// END OF EJS Templates
Rails3: model: replace deprecated before_validation method at CustomField model...
Toshi MARUYAMA -
r8071:f1994ea9c082
parent child
Show More
@@ -28,13 +28,14 class CustomField < ActiveRecord::Base
28 validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
28 validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
29
29
30 validate :validate_values
30 validate :validate_values
31 before_validation :set_searchable
31
32
32 def initialize(attributes = nil)
33 def initialize(attributes = nil)
33 super
34 super
34 self.possible_values ||= []
35 self.possible_values ||= []
35 end
36 end
36
37
37 def before_validation
38 def set_searchable
38 # make sure these fields are not searchable
39 # make sure these fields are not searchable
39 self.searchable = false if %w(int float date bool).include?(field_format)
40 self.searchable = false if %w(int float date bool).include?(field_format)
40 true
41 true
General Comments 0
You need to be logged in to leave comments. Login now