Class: CitizenBudgetModel::QuestionsController

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

Instance Method Summary collapse

Methods inherited from CitizenBudgetModelController

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

Instance Method Details

#createObject



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

def create
  @question = collection.new(question_params)

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

#destroyObject



36
37
38
39
# File 'app/controllers/citizen_budget_model/questions_controller.rb', line 36

def destroy
  @question.destroy
  redirect_to [@simulator, @section], notice: _('Question was deleted.')
end

#editObject



15
16
# File 'app/controllers/citizen_budget_model/questions_controller.rb', line 15

def edit
end

#newObject



11
12
13
# File 'app/controllers/citizen_budget_model/questions_controller.rb', line 11

def new
  @question = collection.new
end

#showObject



8
9
# File 'app/controllers/citizen_budget_model/questions_controller.rb', line 8

def show
end

#updateObject



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

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