Class: Lcms::Engine::SurveysController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lcms/engine/surveys_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/lcms/engine/surveys_controller.rb', line 8

def create
  @form = SurveyForm.new(permitted_params)
  if @form.valid?
    current_user.update(survey: @form.attributes)
    loc = stored_location_for(:user)
    loc = lcms_engine.root_path if loc.is_a?(String) && loc[survey_path]
    redirect_to loc || lcms_engine.root_path
  else
    render :show
  end
end

#showObject



20
21
22
23
24
# File 'app/controllers/lcms/engine/surveys_controller.rb', line 20

def show
  return redirect_to lcms_engine.root_path if current_user.ready_to_go?

  @form = SurveyForm.new(current_user.survey)
end