Method | Saves to DB | Default Accessor | Validations | Callbacks | Touches updated_at | Readonly check |
---|---|---|---|---|---|---|
attribute= | ❌ | ✅ | ||||
write_attribute | ❌ | ❌ | ||||
update_attribute | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
attributes= | ❌ | ✅ | ||||
update | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
update_column | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
update_columns | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
::update | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
::update_all | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Last active
January 25, 2024 18:59
-
-
Save havenwood/dcdf9452476f53505b98 to your computer and use it in GitHub Desktop.
Cheat sheet for setting Rails attributes (from http://www.davidverhasselt.com/set-attributes-in-activerecord/)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment