Class: AskIt::SurveysController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- AskIt::SurveysController
- Defined in:
- app/controllers/ask_it/surveys_controller.rb
Overview
Handles creation and management of surveys
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/ask_it/surveys_controller.rb', line 16 def create @survey = AskIt::Survey.new(survey_params) if @survey.valid? && @survey.save redirect_to surveys_path, notice: I18n.t('surveys_controller.create') else render :new end end |
#edit ⇒ Object
25 26 27 |
# File 'app/controllers/ask_it/surveys_controller.rb', line 25 def edit # @survey is already loaded by before_action end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/ask_it/surveys_controller.rb', line 8 def index @surveys = AskIt::Survey.all end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/ask_it/surveys_controller.rb', line 12 def new @survey = AskIt::Survey.new end |
#show ⇒ Object
29 30 31 |
# File 'app/controllers/ask_it/surveys_controller.rb', line 29 def show # @survey is already loaded by before_action end |
#update ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/ask_it/surveys_controller.rb', line 33 def update if @survey.update(survey_params) redirect_to surveys_path, notice: I18n.t('surveys_controller.update') else render :edit end end |