提交 b15a47de 编写于 作者: S Santosh Wadghule

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

上级 139c232b
......@@ -245,7 +245,7 @@ def becomes!(klass)
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 @@ def decrement!(attribute, by = 1)
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册