mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #18651 from mechanicles/use-public-send
Use 'public_send' over the 'send' method for object's properties and public methods.
This commit is contained in:
commit
2698e18757
1 changed files with 2 additions and 2 deletions
|
@ -245,7 +245,7 @@ module ActiveRecord
|
||||||
def update_attribute(name, value)
|
def update_attribute(name, value)
|
||||||
name = name.to_s
|
name = name.to_s
|
||||||
verify_readonly_attribute(name)
|
verify_readonly_attribute(name)
|
||||||
send("#{name}=", value)
|
public_send("#{name}=", value)
|
||||||
save(validate: false) if changed?
|
save(validate: false) if changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ module ActiveRecord
|
||||||
# method toggles directly the underlying value without calling any setter.
|
# method toggles directly the underlying value without calling any setter.
|
||||||
# Returns +self+.
|
# Returns +self+.
|
||||||
def toggle(attribute)
|
def toggle(attribute)
|
||||||
self[attribute] = !send("#{attribute}?")
|
self[attribute] = !public_send("#{attribute}?")
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue