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:
Toshi MARUYAMA 2011-12-11 12:04:54 +00:00
parent 4f8ed70813
commit f1994ea9c0
1 changed files with 2 additions and 1 deletions

View File

@ -28,13 +28,14 @@ class CustomField < ActiveRecord::Base
validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats
validate :validate_values
before_validation :set_searchable
def initialize(attributes = nil)
super
self.possible_values ||= []
end
def before_validation
def set_searchable
# make sure these fields are not searchable
self.searchable = false if %w(int float date bool).include?(field_format)
true