Masatoshi Nishiguchi
Software Engineer

Updating a db record in Rails

rails database
# Applies the validations.
user.update(name: "The Dude", email: "dude@abides.org")
user.update_attributes(name: "The Dude", email: "dude@abides.org")

# Bypasses the validation.
# For updating a single attribute.
user.update_attribute(:name, "The Dude")
user.update_column(:name, "The Dude")

# Bypasses the validation.
# For updating a single attributes.
user.update_columns(activated: true, activated_at: Time.zone.now)

Reference