aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-23 14:51:59 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-23 14:51:59 -0700
commita225d4bec51778d99ccba5f0d6700dd00d2474f4 (patch)
treea0129ea986f198c21f9693b0c0c4ed4810d54b2b /activerecord/lib
parent2606fb339797a99c50e531105fc92071cef3db01 (diff)
downloadrails-a225d4bec51778d99ccba5f0d6700dd00d2474f4.tar.gz
rails-a225d4bec51778d99ccba5f0d6700dd00d2474f4.tar.bz2
rails-a225d4bec51778d99ccba5f0d6700dd00d2474f4.zip
✂️ and 💅 for #10776
Minor style changes across the board. Changed an alias to an explicit method declaration, since the alias will not be documented otherwise.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/attribute_assignment.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb
index e283db0386..e368fdfff9 100644
--- a/activerecord/lib/active_record/attribute_assignment.rb
+++ b/activerecord/lib/active_record/attribute_assignment.rb
@@ -22,22 +22,10 @@ module ActiveRecord
assign_multiparameter_attributes(multi_parameter_attributes) unless multi_parameter_attributes.empty?
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).
- #
- # If the passed hash responds to <tt>permitted?</tt> method and the return value
- # of this method is +false+ an <tt>ActiveModel::ForbiddenAttributesError</tt>
- # exception is raised.
- #
- # cat = Cat.new(name: "Gorby", status: "yawning")
- # cat.attributes # => { "name" => "Gorby", "status" => "yawning", "created_at" => nil, "updated_at" => nil}
- # cat.assign_attributes(status: "sleeping")
- # cat.attributes # => { "name" => "Gorby", "status" => "sleeping", "created_at" => nil, "updated_at" => nil }
- #
- # New attributes will be persisted in the database when the object is saved.
- #
- # Aliased to <tt>assign_attributes</tt>.
- alias attributes= assign_attributes
+ # Alias for `assign_attributes`. See +ActiveModel::AttributeAssignment+
+ def attributes=(attributes)
+ assign_attributes(attributes)
+ end
private