Class: Effective::TrashController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Effective::TrashController
- Defined in:
- app/controllers/effective/trash_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
This is the User index event.
- #restore ⇒ Object
-
#show ⇒ Object
This is the User show event.
Instance Method Details
#index ⇒ Object
This is the User index event
6 7 8 9 10 11 12 |
# File 'app/controllers/effective/trash_controller.rb', line 6 def index @datatable = EffectiveTrashDatatable.new(self, user_id: current_user.id) @page_title = 'Trash' EffectiveResources.(self, :index, Effective::Trash.new(user_id: current_user.id)) end |
#restore ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/effective/trash_controller.rb', line 22 def restore @trash = Effective::Trash.find(params[:id]) EffectiveResources.(self, :update, @trash) Effective::Trash.transaction do begin @trash.restore! flash[:success] = "Successfully restored #{@trash}" rescue => e flash[:danger] = "Unable to restore: #{e.}" raise ActiveRecord::Rollback end end if request.referer.to_s.include?(effective_trash.admin_trash_index_path) redirect_to effective_trash.admin_trash_index_path else redirect_to effective_trash.trash_index_path end end |