Class: RailsAdmin::Extensions::History::AuditingAdapter

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

Instance Method Summary collapse

Constructor Details

#initialize(controller, user_class = User) ⇒ AuditingAdapter

Returns a new instance of AuditingAdapter.



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

def initialize(controller, user_class = User)
  @controller = controller
  @user_class = user_class
  require 'rails_admin/extensions/history/history'
end

Instance Method Details

#create_object(message, object, abstract_model, user) ⇒ Object



23
24
25
# File 'lib/rails_admin/extensions/history/auditing_adapter.rb', line 23

def create_object(message, object, abstract_model, user)
  ::RailsAdmin::History.create_history_item(message, object, abstract_model, user)
end

#delete_object(message, object, model, user) ⇒ Object



15
16
17
# File 'lib/rails_admin/extensions/history/auditing_adapter.rb', line 15

def delete_object(message, object, model, user)
  ::RailsAdmin::History.create_history_item(message, object, model, user)
end

#latestObject



11
12
13
# File 'lib/rails_admin/extensions/history/auditing_adapter.rb', line 11

def latest
  ::RailsAdmin::History.latest
end

#listing_for_model(model, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20)) ⇒ Object



27
28
29
# File 'lib/rails_admin/extensions/history/auditing_adapter.rb', line 27

def listing_for_model(model, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20))
  ::RailsAdmin::History.history_for_model(model, query, sort, sort_reverse, all, page, per_page)
end

#listing_for_object(model, object, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20)) ⇒ Object



31
32
33
# File 'lib/rails_admin/extensions/history/auditing_adapter.rb', line 31

def listing_for_object(model, object, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20))
  ::RailsAdmin::History.history_for_object(model, object, query, sort, sort_reverse, all, page, per_page)
end

#update_object(model, object, associations_before, associations_after, modified_associations, old_object, user) ⇒ Object



19
20
21
# File 'lib/rails_admin/extensions/history/auditing_adapter.rb', line 19

def update_object(model, object, associations_before, associations_after, modified_associations, old_object, user)
  ::RailsAdmin::History.create_update_history(model, object, associations_before, associations_after, modified_associations, old_object, user)
end