diff options
author | jamie <jamie@soniciq.com> | 2010-01-07 18:44:35 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-07 19:23:59 +0100 |
commit | 0a79eb7889e7ac711ff171a453d65f3df57b9237 (patch) | |
tree | 24b32f38be5aee38a950d75178cc59054c4c288c /activemodel/lib/active_model/validations/presence.rb | |
parent | 2dcc53bdbc1103693626625b29df8bfea7c3bcd4 (diff) | |
download | rails-0a79eb7889e7ac711ff171a453d65f3df57b9237.tar.gz rails-0a79eb7889e7ac711ff171a453d65f3df57b9237.tar.bz2 rails-0a79eb7889e7ac711ff171a453d65f3df57b9237.zip |
Add validates method as shortcut to setup validators for a given set of attributes:
class Person < ActiveRecord::Base
include MyValidators
validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 }
validates :email, :presence => true, :email => true
end
[#3058 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/lib/active_model/validations/presence.rb')
-rw-r--r-- | activemodel/lib/active_model/validations/presence.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index a4c6f866a7..4a71cf79b5 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -34,8 +34,7 @@ module ActiveModel # The method, proc or string should return or evaluate to a true or false value. # def validates_presence_of(*attr_names) - options = attr_names.extract_options! - validates_with PresenceValidator, options.merge(:attributes => attr_names) + validates_with PresenceValidator, _merge_attributes(attr_names) end end end |