redirect to frendly url for debates and proposals if needed

This commit is contained in:
Julian Herrero
2016-01-10 13:38:22 +01:00
parent 083772aa62
commit 7c65b8555c
6 changed files with 96 additions and 0 deletions

View File

@@ -9,6 +9,11 @@ class Management::ProposalsController < Management::BaseController
has_orders %w{confidence_score hot_score created_at most_commented random}, only: [:index, :print]
has_orders %w{most_voted newest}, only: :show
def show
super
redirect_to management_proposal_path(@proposal), status: :moved_permanently if request.path != management_proposal_path(@proposal)
end
def vote
@proposal.register_vote(current_user, 'yes')
set_proposal_votes(@proposal)