Sha256: dbaa647b0b5a6c99c10cbbfc65cf0859f0d1671c31c6c8e388bd15073ac2b698

Contents?: true

Size: 556 Bytes

Versions: 10

Compression:

Stored size: 556 Bytes

Contents

# a simple (manual) unsaved? flag and method. at least it automatically reverts after a save!
class Sequel::Model
  # acts like a dirty? flag, manually thrown during update_record_from_params.
  def unsaved=(val)
    @unsaved = (val) ? true : false
  end

  # whether the unsaved? flag has been thrown
  def unsaved?
    @unsaved
  end

  # automatically unsets the unsaved flag
  def save_with_unsaved_flag(*args)
    result = save_without_unsaved_flag(*args)
    self.unsaved = false
    return result
  end
  alias_method_chain :save, :unsaved_flag
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_scaffold-sequel-0.8.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.7.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.7.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.6.2 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.6.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.6.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.5.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.5.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.4.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-sequel-0.3.0 lib/active_scaffold/extensions/unsaved_record.rb