aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-23 11:53:14 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-23 11:53:14 -0200
commit2698e187578d29292eef3e1cb54338a3afd45a1f (patch)
treee0782be0d5a9b369d1d730c8d8630165e6e94eea /activerecord
parent4e02dcc2521dc74e486faec291684b30565041dc (diff)
parentb15a47deff7d29dc91d59b1fef983bb12e08fb6d (diff)
downloadrails-2698e187578d29292eef3e1cb54338a3afd45a1f.tar.gz
rails-2698e187578d29292eef3e1cb54338a3afd45a1f.tar.bz2
rails-2698e187578d29292eef3e1cb54338a3afd45a1f.zip
Merge pull request #18651 from mechanicles/use-public-send
Use 'public_send' over the 'send' method for object's properties and public methods.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/persistence.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 714d36e7c0..22112fe8ff 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -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