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.
7 8 9 10 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 7 def initialize(version, user_class = User) @version = version @user_class = user_class end |
Instance Method Details
#created_at ⇒ Object
17 18 19 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 17 def created_at @version.created_at end |
#item ⇒ Object
29 30 31 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 29 def item @version.item_id end |
#message ⇒ Object
12 13 14 15 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 12 def @message = @version.event @version.respond_to?(:changeset) && @version.changeset.present? ? @message + ' [' + @version.changeset.to_a.collect { |c| c[0] + ' = ' + c[1][1].to_s }.join(', ') + ']' : @message end |
#table ⇒ Object
21 22 23 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 21 def table @version.item_type end |
#username ⇒ Object
25 26 27 |
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 25 def username (@user_class.find(@version.whodunnit).try(:email) rescue nil) || @version.whodunnit end |