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