Class: PaperTrailHistory::VersionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/paper_trail_history/versions_controller.rb

Overview

Controller for managing version operations like viewing and restoring specific versions

Instance Method Summary collapse

Instance Method Details

#restoreObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/paper_trail_history/versions_controller.rb', line 13

def restore
  result = VersionService.restore_version(@version.id)

  if result[:success]
    redirect_back fallback_location: version_path(@version),
                  notice: result[:message]
  else
    redirect_back fallback_location: version_path(@version),
                  alert: t('paper_trail_history.errors.restore_failed', error: result[:error])
  end
end

#showObject



8
9
10
11
# File 'app/controllers/paper_trail_history/versions_controller.rb', line 8

def show
  @decorated_version = VersionDecorator.decorate(@version)
  @trackable_model = TrackableModel.find(@version.item_type)
end