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.43 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.42 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.41.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.41 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.40 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.39 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.38 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.37 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.36 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.35 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.34 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.33 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.32 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.31 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.30 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.29 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.28 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.27 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.26 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.4.25 lib/active_scaffold/extensions/unsaved_record.rb