1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Docs: Fix output representation [ci skip]

The output of two string attributes is displayed differently in the docs. Standardize the output by always showing it as a comment.
This commit is contained in:
Viktor Fonic 2017-05-31 10:21:51 +08:00 committed by GitHub
parent 763ef6d2fa
commit ea2850b96a

View file

@ -19,10 +19,10 @@ module ActiveModel
# cat = Cat.new
# cat.assign_attributes(name: "Gorby", status: "yawning")
# cat.name # => 'Gorby'
# cat.status => 'yawning'
# cat.status # => 'yawning'
# cat.assign_attributes(status: "sleeping")
# cat.name # => 'Gorby'
# cat.status => 'sleeping'
# cat.status # => 'sleeping'
def assign_attributes(new_attributes)
if !new_attributes.respond_to?(:stringify_keys)
raise ArgumentError, "When assigning attributes, you must pass a hash as an argument."