Sha256: 252c324237a8d5093555e441e9bda9567d19ade38c00ef18f7ab46b6260d39d6

Contents?: true

Size: 561 Bytes

Versions: 212

Compression:

Stored size: 561 Bytes

Contents

# a simple (manual) unsaved? flag and method. at least it automatically reverts after a save!
class ActiveRecord::Base
  # 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

212 entries across 212 versions & 8 rubygems

Version Path
active_scaffold_vho-4.0.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.14 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.13 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.12 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.11 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.10 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.9 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.8 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.7 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.6 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.5 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.4 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.3 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.2 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.1 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.2.0 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.0.31 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold_vho-3.1.8 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.3.3 lib/active_scaffold/extensions/unsaved_record.rb
active_scaffold-3.3.2 lib/active_scaffold/extensions/unsaved_record.rb