Class: RailsAdmin::Extensions::PaperTrail::VersionProxy
- Inherits:
-
Object
- Object
- RailsAdmin::Extensions::PaperTrail::VersionProxy
- Defined in:
- lib/rails_admin/extensions/paper_trail/auditing_adapter.rb
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(version, user_class = User) ⇒ VersionProxy
constructor
A new instance of VersionProxy.
- #item ⇒ Object
- #message ⇒ Object
- #table ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(version, user_class = User) ⇒ VersionProxy
Returns a new instance of VersionProxy.
9 10 11 12 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 9 def initialize(version, user_class = User) @version = version @user_class = user_class end |
Instance Method Details
#created_at ⇒ Object
19 20 21 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 19 def created_at @version.created_at end |
#item ⇒ Object
35 36 37 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 35 def item @version.item_id end |
#message ⇒ Object
14 15 16 17 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 14 def @message = @version.event @version.respond_to?(:changeset) && @version.changeset.present? ? @message + ' [' + @version.changeset.to_a.collect { |c| "#{c[0]} = #{c[1][1]}" }.join(', ') + ']' : @message end |
#table ⇒ Object
23 24 25 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 23 def table @version.item_type end |
#username ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 27 def username begin @user_class.find(@version.whodunnit).try(:email) rescue StandardError nil end || @version.whodunnit end |