| Class | Admin::QuestionsController |
| In: |
app/controllers/admin/questions_controller.rb
|
| Parent: | Admin::BaseController |
POST /questions POST /questions.xml
# File app/controllers/admin/questions_controller.rb, line 41
41: def create
42: @question = Question.new(params[:question])
43: assign_groups(@question, params)
44:
45: respond_to do |format|
46: if @question.save
47: update_translations(params, @question, 'Question')
48: flash[:notice] = 'Question was successfully created.'
49: format.html { redirect_to(admin_question_path(@question)) }
50: format.xml { render :xml => @question, :status => :created, :location => @question }
51: else
52: format.html { render :action => "new" }
53: format.xml { render :xml => @question.errors, :status => :unprocessable_entity }
54: end
55: end
56: end
DELETE /questions/1 DELETE /questions/1.xml
# File app/controllers/admin/questions_controller.rb, line 79
79: def destroy
80: @question = Question.find(params[:id])
81: @question.destroy
82:
83: respond_to do |format|
84: format.html { redirect_to(admin_questions_path) }
85: format.xml { head :ok }
86: end
87: end
GET /questions/1/edit
# File app/controllers/admin/questions_controller.rb, line 34
34: def edit
35: @question = Question.find(params[:id])
36: @group = @question.groups.first
37: end
# File app/controllers/admin/questions_controller.rb, line 2 2: def index 3: @questions = Question.find(:all) 4: 5: respond_to do |format| 6: format.html # index.html.erb 7: format.xml { render :xml => @questions } 8: end 9: end
GET /questions/new GET /questions/new.xml
# File app/controllers/admin/questions_controller.rb, line 24
24: def new
25: @question = Question.new
26:
27: respond_to do |format|
28: format.html # new.html.erb
29: format.xml { render :xml => @question }
30: end
31: end
GET /questions/1 GET /questions/1.xml
# File app/controllers/admin/questions_controller.rb, line 13
13: def show
14: @question = Question.find(params[:id])
15:
16: respond_to do |format|
17: format.html # show.html.erb
18: format.xml { render :xml => @question }
19: end
20: end
PUT /questions/1 PUT /questions/1.xml
# File app/controllers/admin/questions_controller.rb, line 60
60: def update
61: @question = Question.find(params[:id])
62: assign_groups(@question, params)
63:
64: respond_to do |format|
65: if @question.update_attributes(params[:question])
66: update_translations(params, @question, 'Question')
67: flash[:notice] = 'Question was successfully updated.'
68: format.html { redirect_to(admin_question_path(@question)) }
69: format.xml { head :ok }
70: else
71: format.html { render :action => "edit" }
72: format.xml { render :xml => @question.errors, :status => :unprocessable_entity }
73: end
74: end
75: end