Module: ActiveAdmin::Audit::HasVersions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_admin/audit/has_versions.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#additional_objects_snapshot_changes ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/active_admin/audit/has_versions.rb', line 88 def additional_objects_snapshot_changes prev_version = versions.last old_snapshot = prev_version.try(:additional_objects) || VersionSnapshot.new new_snapshot = additional_objects_snapshot old_snapshot.diff(new_snapshot) end |
#latest_versions(count = 5) ⇒ Object
84 85 86 |
# File 'lib/active_admin/audit/has_versions.rb', line 84 def latest_versions(count = 5) versions.reorder(created_at: :desc).limit(count).rewhere(item_type: self.class.name) end |