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
19
# 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)
    notify_heap
    loc = stored_location_for(:user)
    loc = root_path if loc.is_a?(String) && loc[survey_path]
    redirect_to loc || root_path
  else
    render :show
  end
end

#showObject



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

def show
  return redirect_to root_path if current_user.ready_to_go?

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