Class: Flexite::HistoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/flexite/histories_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
# File 'app/controllers/flexite/histories_controller.rb', line 5

def index
  @histories = History
    .includes(:history_attributes)
    .where(entity_id: params[:entity_id], entity_type: params[:entity_type].camelize)
end

#restoreObject



11
12
13
14
# File 'app/controllers/flexite/histories_controller.rb', line 11

def restore
  History.includes(:history_attributes).find(params[:history_id]).restore
  flash[:success] = 'Entity was restored from history'
end