Class: RailsAdmin::Extensions::History::AuditingAdapter
- Inherits:
-
Object
- Object
- RailsAdmin::Extensions::History::AuditingAdapter
- Defined in:
- lib/rails_admin/extensions/history/auditing_adapter.rb
Instance Method Summary collapse
- #create_object(message, object, abstract_model, user) ⇒ Object
- #delete_object(message, object, model, user) ⇒ Object
-
#initialize(controller, user_class = User) ⇒ AuditingAdapter
constructor
A new instance of AuditingAdapter.
- #latest ⇒ Object
- #listing_for_model(model, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20)) ⇒ Object
- #listing_for_object(model, object, query, sort, sort_reverse, all, page, per_page = (RailsAdmin::Config.default_items_per_page || 20)) ⇒ Object
- #update_object(model, object, associations_before, associations_after, modified_associations, old_object, user) ⇒ Object
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(, object, abstract_model, user) ::RailsAdmin::History.create_history_item(, 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(, object, model, user) ::RailsAdmin::History.create_history_item(, object, model, user) end |
#latest ⇒ Object
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 |