Sha256: 9d61afba41b257a63b4128a989138d1f835473ccbc3ab119a22e07f5a621cfe1

Contents?: true

Size: 531 Bytes

Versions: 46

Compression:

Stored size: 531 Bytes

Contents

# a simple (manual) unsaved? flag and method. at least it automatically reverts after a save!
module ActiveScaffold::UnsavedRecord
  # 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(*)
    super.tap { self.unsaved = false }
  end
end
ActiveRecord::Base.class_eval { include ActiveScaffold::UnsavedRecord }

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
active_scaffold-3.4.24 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.23 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.22 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.21.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.21 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.20 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.19 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.18.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.18 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.17 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.16 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.14 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.13 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.12 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.11 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.10 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.9 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.8 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.7 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.5 lib/active_scaffold/extensions/unsaved_record.rb