Class: Plum::Cp::EntryRevisionsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Plum::Cp::EntryRevisionsController
- Defined in:
- app/controllers/plum/cp/entry_revisions_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
7 8 9 |
# File 'app/controllers/plum/cp/entry_revisions_controller.rb', line 7 def index @revisions = @entry.revisions.order(created_at: :desc) end |
#restore ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/controllers/plum/cp/entry_revisions_controller.rb', line 11 def restore revision = @entry.revisions.find(params[:id]) @entry.restore_revision!(revision, editor: current_user) redirect_to edit_cp_content_type_entry_path(@content_type, @entry), notice: "Revision restored" rescue ActiveRecord::RecordInvalid => error redirect_to cp_content_type_entry_revisions_path(@content_type, @entry), alert: "Could not restore revision: #{error.record.errors..to_sentence}" end |