# -*- encoding : utf-8 -*-

class SurveySetsController < ApplicationController
  
  def index
   
  end
  def new 
    

    @survey = SurveyType.find_by_slug(params[:slug])
    @survey_set = @survey.to_survey_set
    @title = "Le Pic Vert - Sondage : "+@survey_set.survey_type.name
    
  end
  
  def create
      
    @survey_set = SurveySet.new(params[:survey_set])
    
    @title = "Le Pic Vert - Sondage : "+@survey_set.survey_type.name
    
    if @survey_set.save
      redirect_to thank_survey_set_path(:slug => @survey_set.survey_type.slug)
    else
      render :action => :new
    end
  end
  
  def thank
 
     @survey = SurveyType.find_by_slug(params[:slug])
     @title = "Le Pic Vert - Sondage : "+@survey.name
  end
end
