Method: PaperTrail::RecordTrail#record_update
- Defined in:
- lib/paper_trail/record_trail.rb
#record_update(force:, in_after_callback:, is_touch:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
paper_trail-association_tracking
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/paper_trail/record_trail.rb', line 104 def record_update(force:, in_after_callback:, is_touch:) return unless enabled? version = build_version_on_update( force: force, in_after_callback: in_after_callback, is_touch: is_touch ) return unless version begin version.save! # Because the version object was created using version_class.new instead # of versions_assoc.build?, the association cache is unaware. So, we # invalidate the `versions` association cache with `reset`. versions.reset version rescue StandardError => e handle_version_errors e, version, :update end end |