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

Use 'public_send' over the 'send' method for object's properties.

This commit is contained in:
Santosh Wadghule 2015-01-23 11:08:50 +05:30
parent 139c232b07
commit b15a47deff

View file

@ -245,7 +245,7 @@ module ActiveRecord
def update_attribute(name, value)
name = name.to_s
verify_readonly_attribute(name)
send("#{name}=", value)
public_send("#{name}=", value)
save(validate: false) if changed?
end
@ -352,7 +352,7 @@ module ActiveRecord
# method toggles directly the underlying value without calling any setter.
# Returns +self+.
def toggle(attribute)
self[attribute] = !send("#{attribute}?")
self[attribute] = !public_send("#{attribute}?")
self
end