Class: RailsAdmin::Extensions::PaperTrail::VersionProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_admin/extensions/paper_trail/auditing_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, user_class = User) ⇒ VersionProxy

Returns a new instance of VersionProxy.



5
6
7
8
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 5

def initialize(version, user_class = User)
  @version = version
  @user_class = user_class
end

Instance Method Details

#created_atObject



14
15
16
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 14

def created_at
  @version.created_at
end

#itemObject



26
27
28
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 26

def item
  @version.item_id
end

#messageObject



10
11
12
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 10

def message
  "#{@version.event} #{@version.item_type} id #{@version.item_id}"
end

#tableObject



18
19
20
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 18

def table
  @version.item_type
end

#usernameObject



22
23
24
# File 'lib/rails_admin/extensions/paper_trail/auditing_adapter.rb', line 22

def username
  @user_class.find_by_id(@version.whodunnit).try(:email) || @version.whodunnit
end