diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-09-19 19:19:11 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-09-19 19:19:11 -0500 |
commit | 97338d581484521263f066db3e79775a5c311e83 (patch) | |
tree | 16c79bf51da020c6eaf22c62ee659442dc2b21a9 /activerecord | |
parent | 731d8095355225a9777922c92b453b0c9c7e8e03 (diff) | |
download | rails-97338d581484521263f066db3e79775a5c311e83.tar.gz rails-97338d581484521263f066db3e79775a5c311e83.tar.bz2 rails-97338d581484521263f066db3e79775a5c311e83.zip |
AR::Base#attributes= is just an alias for AR::Base#assign_attributes
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_assignment.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index ccc61ec5d3..fa8c5ac95c 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -5,20 +5,12 @@ module ActiveRecord include ActiveModel::DeprecatedMassAssignmentSecurity include ActiveModel::ForbiddenAttributesProtection - # Allows you to set all the attributes at once by passing in a hash with keys - # matching the attribute names (which again matches the column names). + # Allows you to set all the attributes by passing in a hash of attributes with + # keys matching the attribute names (which again matches the column names) # # If the passed hash responds to permitted? method and the return value # of this method is false an ActiveModel::ForbiddenAttributesError exception # is raised. - def attributes=(new_attributes) - return unless new_attributes.is_a?(Hash) - - assign_attributes(new_attributes) - end - - # Allows you to set all the attributes by passing in a hash of attributes with - # keys matching the attribute names (which again matches the column names) def assign_attributes(new_attributes) return if new_attributes.blank? @@ -42,6 +34,8 @@ module ActiveRecord assign_multiparameter_attributes(multi_parameter_attributes) unless multi_parameter_attributes.empty? end + alias attributes= assign_attributes + private def _assign_attribute(k, v) |