Created
August 2, 2018 02:51
-
-
Save 3014zhangshuo/6c55feb9b1b0e3b0716119a2aa929aef to your computer and use it in GitHub Desktop.
Dynamic set object attributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = Article.find(3) | |
a[param] = "value" | |
a.save | |
# or | |
a = Article.find(3) | |
a.send("#{param}=", "value") | |
a.save | |
# or | |
update_attribute |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment