Rails3: replace deprecated 'validate' method at Query model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7425 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
85fe235b68
commit
5c46cede2b
|
@ -92,6 +92,7 @@ class Query < ActiveRecord::Base
|
||||||
|
|
||||||
validates_presence_of :name, :on => :save
|
validates_presence_of :name, :on => :save
|
||||||
validates_length_of :name, :maximum => 255
|
validates_length_of :name, :maximum => 255
|
||||||
|
validate :validate_query_filters
|
||||||
|
|
||||||
@@operators = { "=" => :label_equals,
|
@@operators = { "=" => :label_equals,
|
||||||
"!" => :label_not_equals,
|
"!" => :label_not_equals,
|
||||||
|
@ -168,7 +169,7 @@ class Query < ActiveRecord::Base
|
||||||
@is_for_all = project.nil?
|
@is_for_all = project.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate
|
def validate_query_filters
|
||||||
filters.each_key do |field|
|
filters.each_key do |field|
|
||||||
if values_for(field)
|
if values_for(field)
|
||||||
case type_for(field)
|
case type_for(field)
|
||||||
|
|
Loading…
Reference in New Issue