Class: CitizenBudgetModel::SimulatorsController
Instance Method Summary
collapse
#admin?, #check_authorization!, #set_locale, #simulators, #users
Instance Method Details
#activate ⇒ Object
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
|
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#edit ⇒ Object
17
18
|
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 17
def edit
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 6
def index
@simulators = collection.all.sort_by(&:name)
end
|
#new ⇒ Object
13
14
15
|
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 13
def new
@simulator = collection.new
end
|
#show ⇒ Object
10
11
|
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 10
def show
end
|
#sort ⇒ Object
48
49
50
|
# File 'app/controllers/citizen_budget_model/simulators_controller.rb', line 48
def sort
super(@simulator.sections)
end
|
#update ⇒ Object
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
|