Class: RecordVersion
- Inherits:
-
RecordVersionBase
- Object
- ActiveRecord::Base
- RecordVersionBase
- RecordVersion
- Includes:
- PaperTrail::VersionConcern
- Defined in:
- app/models/record_version.rb
Overview
== Schema Information
Table name: versions(partitioned,partition_key:created_at)
Database name: versions
id :integer not null, primary key
event :string(255) not null
ip :string(255)
item_type :string(255) not null
object_changes :jsonb
reference_data :jsonb
url :text
whodunnit :string(255)
created_at :datetime not null
item_id :integer not null
Constant Summary
Constants inherited from RecordVersionBase
RecordVersionBase::CONNECTION_ERRORS
Belongs to collapse
Class Method Summary collapse
- .ransackable_scopes(_auth_object = nil) ⇒ Object
-
.with_attribute_changed ⇒ ActiveRecord::Relation<RecordVersion>
A relation of RecordVersions that are with attribute changed.
Instance Method Summary collapse
- #changes ⇒ Object
-
#object ⇒ Object
Fake it!.
Methods inherited from RecordVersionBase
Class Method Details
.ransackable_scopes(_auth_object = nil) ⇒ Object
44 45 46 |
# File 'app/models/record_version.rb', line 44 def self.ransackable_scopes(_auth_object = nil) %i[with_changes_to] end |
.with_attribute_changed ⇒ ActiveRecord::Relation<RecordVersion>
A relation of RecordVersions that are with attribute changed. Active Record Scope
33 |
# File 'app/models/record_version.rb', line 33 scope :with_attribute_changed, ->(attribute) { where('object_changes ?& array[:keys]', keys: [attribute]) } |
Instance Method Details
#changes ⇒ Object
40 41 42 |
# File 'app/models/record_version.rb', line 40 def changes (object_changes || {}).reject { |_k, v| v.all?(&:nil?) } end |
#object ⇒ Object
Fake it!
36 37 38 |
# File 'app/models/record_version.rb', line 36 def object {} end |
#responsible_party ⇒ Party
26 |
# File 'app/models/record_version.rb', line 26 belongs_to :responsible_party, foreign_key: :whodunnit, class_name: 'Party', optional: true |