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