update_columns

update_columns(attributes) Instance Public methods Updates the attributes directly in the database issuing an UPDATE SQL statement and sets them in the receiver: user.update_columns(last_request_at: Time.current) This is the fastest way to update attributes because it goes straight to the database, but take into account that in consequence the regular update procedures are totally bypassed. In particular: Validations are skipped. Callbacks are skipped. updated_at/updated_on a

update_column

update_column(name, value) Instance Public methods Equivalent to update_columns(name => value).

update_attributes!

update_attributes!(attributes) Instance Public methods Alias for: update!

update_attributes

update_attributes(attributes) Instance Public methods Alias for: update

update_attribute

update_attribute(name, value) Instance Public methods Updates a single attribute and saves the record. This is especially useful for boolean flags on existing records. Also note that Validation is skipped. Callbacks are invoked. updated_at/updated_on column is updated if that column is available. Updates all the attributes that are dirty in this object. This method raises an ActiveRecord::ActiveRecordError if the attribute is marked as readonly.

update!

update!(attributes) Instance Public methods Updates its receiver just like update but calls save! instead of save, so an exception is raised if the record is invalid. update_attributes!

update

update(attributes) Instance Public methods Updates the attributes of the model from the passed-in hash and saves the record, all wrapped in a transaction. If the object is invalid, the saving will fail and false will be returned. update_attributes

touch

touch(name = nil) Instance Public methods Saves the record with the updated_at/on attributes set to the current time. Please note that no validation is performed and only the after_touch, after_commit and after_rollback callbacks are executed. If an attribute name is passed, that attribute is updated along with updated_at/on attributes. product.touch # updates updated_at/on product.touch(:designed_at) # updates the designed_at attribute and updated_at/on If used alon

toggle!

toggle!(attribute) Instance Public methods Wrapper around toggle that saves the record. This method differs from its non-bang version in that it passes through the attribute setter. Saving is not subjected to validation checks. Returns true if the record could be saved.

toggle

toggle(attribute) Instance Public methods Assigns to attribute the boolean opposite of attribute?. So if the predicate returns true the attribute will become false. This method toggles directly the underlying value without calling any setter. Returns self.