Method: Sequel::Model::InstanceMethods#modified!

Defined in:
lib/sequel/model/base.rb

#modified!(column = nil) ⇒ Object

Explicitly mark the object as modified, so save_changes/update will run callbacks even if no columns have changed.

a = Artist[1]
a.save_changes # No callbacks run, as no changes
a.modified!
a.save_changes # Callbacks run, even though no changes made

If a column is given, specifically marked that column as modified, so that save_changes/update will include that column in the update. This should be used if you plan on mutating the column value instead of assigning a new column value:

a.modified!(:name)
a.name.gsub!(/[aeou]/, 'i')


1444
1445
1446
1447
1448
1449
# File 'lib/sequel/model/base.rb', line 1444

def modified!(column=nil)
  if column && !changed_columns.include?(column)
    changed_columns << column
  end
  @modified = true
end