Remove obsolete routes for poll questions
The routes for poll questions were accidentally deleted in commit5bb831e959when deleting the `:show` action, and restored in commit9871503c5e. However, the deleted code was: ``` resources :questions, only: [:show], controller: 'polls/questions' (...) ``` While the restored code was: ``` resources :questions, controller: 'polls/questions' (...) ``` Meaning we forgot to add the `only: []` option when restoring the routes. We also forgot to remove the `before_action` code when deleting the `:show` action, so we're removing it now.
This commit is contained in:
@@ -2,8 +2,6 @@ class Polls::QuestionsController < ApplicationController
|
|||||||
load_and_authorize_resource :poll
|
load_and_authorize_resource :poll
|
||||||
load_and_authorize_resource :question, class: "Poll::Question"
|
load_and_authorize_resource :question, class: "Poll::Question"
|
||||||
|
|
||||||
has_orders %w[most_voted newest oldest], only: :show
|
|
||||||
|
|
||||||
def answer
|
def answer
|
||||||
answer = @question.find_or_initialize_user_answer(current_user, params[:answer])
|
answer = @question.find_or_initialize_user_answer(current_user, params[:answer])
|
||||||
answer.save_and_record_voter_participation
|
answer.save_and_record_voter_participation
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ resources :polls, only: [:show, :index] do
|
|||||||
get :results
|
get :results
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :questions, controller: "polls/questions", shallow: true do
|
resources :questions, controller: "polls/questions", shallow: true, only: [] do
|
||||||
post :answer, on: :member
|
post :answer, on: :member
|
||||||
resources :answers, controller: "polls/answers", only: :destroy, shallow: false
|
resources :answers, controller: "polls/answers", only: :destroy, shallow: false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -53,12 +53,6 @@ describe "Polymorphic routes" do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "routes poll questions" do
|
|
||||||
question = create(:poll_question)
|
|
||||||
|
|
||||||
expect(polymorphic_path(question)).to eq question_path(question)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "routes topics" do
|
it "routes topics" do
|
||||||
community = create(:proposal).community
|
community = create(:proposal).community
|
||||||
topic = create(:topic, community: community)
|
topic = create(:topic, community: community)
|
||||||
|
|||||||
Reference in New Issue
Block a user