module Granite::Transactions
Direct including types
Defined in:
granite/transactions.crInstance Method Summary
-
#destroy
Removes the record from the database.
-
#destroy!
Same as
#destroy
, but raisesGranite::RecordNotDestroyed
if unsuccessful. -
#save(*, validate : Bool = true, skip_timestamps : Bool = false)
Attempts to save the record to the database, returning
true
if successful, andfalse
if not. -
#save!(*, validate : Bool = true, skip_timestamps : Bool = false)
Same as
#save
, but raisesGranite::RecordNotSaved
if the save is unsuccessful. -
#set_timestamps(*, to time = Time.local(Granite.settings.default_timezone), mode = :create)
Sets the record's timestamps(created_at & updated_at) to the current time.
-
#touch(*fields) : Bool
Updates the updated_at field to the current time, without saving other fields.
-
#update(args, skip_timestamps : Bool = false)
Updates the record with the new data specified by args, with the option to not update timestamps.
-
#update(**args)
Updates the record with the new data specified by args.
-
#update!(args, skip_timestamps : Bool = false)
Updates the record with the new data specified by args, with the option to not update timestamps.
-
#update!(**args)
Updates the record with the new data specified by args.
Instance Method Detail
Attempts to save the record to the database, returning true
if successful,
and false
if not. If the save is unsuccessful, #errors
will be populated
with the errors which caused the save to fail.
NOTE: This method can be used both on new records, and existing records. In the case of new records, it creates the record in the database, otherwise, it updates the record in the database.
Same as #save
, but raises Granite::RecordNotSaved
if the save is unsuccessful.
Sets the record's timestamps(created_at & updated_at) to the current time.
Updates the updated_at field to the current time, without saving other fields.
Raises error if record hasn't been saved to the database yet.
Updates the record with the new data specified by args, with the option to
not update timestamps. Returns true
if the update is successful, false
if
it isn't.
Updates the record with the new data specified by args. Returns true
if the
update is successful, false
if it isn't.
Updates the record with the new data specified by args, with the option to
not update timestamps. Raises Granite::RecordNotSaved
if the save is
unsuccessful.
Updates the record with the new data specified by args. Raises
Granite::RecordNotSaved
if the save is unsuccessful.