Class: CitizenBudgetModel::SectionsController

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

Instance Method Summary collapse

Methods inherited from CitizenBudgetModelController

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

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/citizen_budget_model/sections_controller.rb', line 17

def create
  @section = collection.new(section_params)

  if @section.save
    redirect_to [@simulator, @section], notice: _('Section was created.')
  else
    render :new
  end
end

#destroyObject



35
36
37
38
# File 'app/controllers/citizen_budget_model/sections_controller.rb', line 35

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

#editObject



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

def edit
end

#newObject



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

def new
  @section = collection.new
end

#showObject



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

def show
end

#sortObject



40
41
42
# File 'app/controllers/citizen_budget_model/sections_controller.rb', line 40

def sort
  super(@section.questions)
end

#updateObject



27
28
29
30
31
32
33
# File 'app/controllers/citizen_budget_model/sections_controller.rb', line 27

def update
  if @section.update(section_params)
    redirect_to [@simulator, @section], notice: _('Section was updated.')
  else
    render :edit
  end
end