diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-06-17 20:19:21 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-06-17 21:27:54 -0500 |
commit | d5d59230f4d8f0457fc793446a3dbcdce0057a78 (patch) | |
tree | e3a6ce7cd8ca3f7583fd62b284485d0752477c60 /activemodel/lib/active_model/validations.rb | |
parent | b4a91db441fa9583df24fb8d3cf0d6906e8359db (diff) | |
download | rails-d5d59230f4d8f0457fc793446a3dbcdce0057a78.tar.gz rails-d5d59230f4d8f0457fc793446a3dbcdce0057a78.tar.bz2 rails-d5d59230f4d8f0457fc793446a3dbcdce0057a78.zip |
Simplify AMo validation attribute reader
Diffstat (limited to 'activemodel/lib/active_model/validations.rb')
-rw-r--r-- | activemodel/lib/active_model/validations.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 6b6f51d942..5223cea135 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -64,7 +64,7 @@ module ActiveModel # Declare the validation. send(validation_method(options[:on]), options) do |record| attrs.each do |attr| - value = record.get_attribute_value(attr) + value = record.send(attr) next if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank]) yield record, attr, value end @@ -93,10 +93,6 @@ module ActiveModel def invalid? !valid? end - - def get_attribute_value(attribute) - respond_to?(attribute.to_sym) ? send(attribute.to_sym) : instance_variable_get(:"@#{attribute}") - end end end |