Class: Rostra::Base::AnswersController
Instance Method Summary
collapse
#can_participate_in_rostra?, #main_app_login_path, #main_app_signup_path, #rostra_user
Methods included from Config
setup
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
|
# File 'app/controllers/rostra/base/answers_controller.rb', line 15
def create
if @answer.save
redirect_to question_path(@question)
else
render :new
end
end
|
#edit ⇒ Object
23
24
|
# File 'app/controllers/rostra/base/answers_controller.rb', line 23
def edit
end
|
#update ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/controllers/rostra/base/answers_controller.rb', line 26
def update
if @answer.update_attributes(params[:answer])
redirect_to question_path(@question, anchor: "rostra_answer_#{@answer.id}")
else
render :edit
end
end
|
#vote ⇒ Object
7
8
9
10
11
12
13
|
# File 'app/controllers/rostra/base/answers_controller.rb', line 7
def vote
rostra_user.vote_on(@answer, params[:vote_direction])
respond_to do |format|
format.html { redirect_to question_path(@question, anchor: "rostra_answer_#{@answer.id}") }
format.js
end
end
|