Module: Snaptime::Versioned
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/snaptime/versioned.rb,
lib/snaptime/versioned/scopes.rb
Defined Under Namespace
Modules: ClassMethods, Scopes
Instance Method Summary collapse
- #_run_create_callbacks(*args, &block) ⇒ Object
-
#_run_update_callbacks(*args, &block) ⇒ Object
To make sure our before_update always runs after all other before_update methods, we override #_run_update_callbacks.
- #delete ⇒ Object
- #destroy ⇒ Object
Methods included from Scopes
#all_versions, #at_snaptime, #snaptimes, #with_snaptime
Instance Method Details
#_run_create_callbacks(*args, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/snaptime/versioned.rb', line 22 def _run_create_callbacks(*args, &block) super do ArHooks.before_create(self) yield ArHooks.after_create(self) end end |
#_run_update_callbacks(*args, &block) ⇒ Object
To make sure our before_update always runs after all other before_update methods, we override #_run_update_callbacks. This prevents cases where an after_update callback changes the record after it has already been detected as no-changed. In this case, no shadow clone would be created.
34 35 36 37 38 39 |
# File 'lib/snaptime/versioned.rb', line 34 def _run_update_callbacks(*args, &block) super do ArHooks.before_update(self) yield end end |
#delete ⇒ Object
45 46 47 |
# File 'lib/snaptime/versioned.rb', line 45 def delete fail Exceptions::DeleteMethodsAreNotAvailable end |