# File app/controllers/survey/questions_controller.rb, line 13 def answer @survey_question = Survey::Question.find(params[:id]) if (params[:key].nil? || params[:key].empty?) user = current_user else k=Key.find_by_uuid(params[:key] ) if k.is_valid && k.typ==3 && k.parent == @survey_question user = k.user end end @survey_question.do_answer(params[:survey_question][:selected],user) respond_to do |format| format.html { redirect_to action: :show} format.js { render action: :show} end end
POST /survey/questions POST /survey/questions.json
# File app/controllers/survey/questions_controller.rb, line 66 def create @survey_question = Survey::Question.new(params[:survey_question]) @survey_question.user=current_user respond_to do |format| if @survey_question.save format.html { redirect_to @survey_question, notice: 'Question was successfully created.' } else format.html { render action: "new" } end end end
GET /survey/questions/1 GET /survey/questions/1.json
# File app/controllers/survey/questions_controller.rb, line 32 def create_from_template @template = Survey::Question.find(params[:id]) parent= params[:parent_type].constantize.find(params[:parent_id]) @survey_question = @template.copy_from_template_for(parent) @survey_question.user=current_user render action: :show end
DELETE /survey/questions/1 DELETE /survey/questions/1.json
# File app/controllers/survey/questions_controller.rb, line 95 def destroy @survey_question = Survey::Question.find(params[:id]) @survey_question.destroy respond_to do |format| format.html { redirect_to survey_questions_url } end end
GET /survey/questions/1/edit
# File app/controllers/survey/questions_controller.rb, line 60 def edit @survey_question = Survey::Question.find(params[:id]) end
# File app/controllers/survey/questions_controller.rb, line 6 def index @survey_questions = Survey::Question.all respond_to do |format| format.html # index.html.erb end end
GET /survey/questions/new GET /survey/questions/new.json
# File app/controllers/survey/questions_controller.rb, line 50 def new @survey_question = Survey::Question.new @parent=params[:parent_type].constantize.find(params[:parent_id]) @survey_question.parent=@parent respond_to do |format| format.html # new.html.erb end end
# File app/controllers/survey/questions_controller.rb, line 40 def show @survey_question = Survey::Question.find(params[:id]) respond_to do |format| format.html # show.html.erb end end
PUT /survey/questions/1 PUT /survey/questions/1.json
# File app/controllers/survey/questions_controller.rb, line 80 def update @survey_question = Survey::Question.find(params[:id]) @survey_question.user=current_user @survey_question.save respond_to do |format| if @survey_question.update_attributes(params[:survey_question]) format.html { redirect_to @survey_question, notice: 'Question was successfully updated.' } else format.html { render action: "edit" } end end end
Generated with the Darkfish Rdoc Generator 2.