Class: CitizenBudgetModel::SimulatorsController

Inherits:
CitizenBudgetModelController show all
Defined in:
app/controllers/citizen_budget_model/simulators_controller.rb

Instance Method Summary collapse

Methods inherited from CitizenBudgetModelController

#admin?, #check_authorization!, #set_locale, #simulators, #users

Instance Method Details

#activateObject



43
44
45
46
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 43

def activate
  @simulator.activate!
  redirect_to @simulator, notice: _('Simulator was activated.')
end

#createObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 20

def create
  @simulator = collection.new(simulator_params)

  if @simulator.save
    redirect_to @simulator, notice: _('Simulator was created.')
  else
    render :new
  end
end

#destroyObject



38
39
40
41
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 38

def destroy
  @simulator.destroy
  redirect_to simulators_path, notice: _('Simulator was deleted.')
end

#editObject



17
18
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 17

def edit
end

#indexObject



6
7
8
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 6

def index
  @simulators = collection.all.sort_by(&:name)
end

#newObject



13
14
15
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 13

def new
  @simulator = collection.new
end

#showObject



10
11
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 10

def show
end

#sortObject



48
49
50
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 48

def sort
  super(@simulator.sections)
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 30

def update
  if @simulator.update(simulator_params)
    redirect_to @simulator, notice: _('Simulator was updated.')
  else
    render :edit
  end
end