Class/Module Index [+]

Quicksearch

Survey::QuestionsController

Public Instance Methods

answer() click to toggle source
# 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
create() click to toggle source

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
create_from_template() click to toggle source

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
destroy() click to toggle source

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
edit() click to toggle source

GET /survey/questions/1/edit

# File app/controllers/survey/questions_controller.rb, line 60
def edit
  @survey_question = Survey::Question.find(params[:id])
end
index() click to toggle source
# 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
new() click to toggle source

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
show() click to toggle source
# 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
update() click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.