ruby - Rails 3 - overwriting routes -
I'm currently having some problems setting up the right path for my application. URLs like: In addition, the user should be able to filter the elections against certain criteria such as show top-poll, new-pole And so ... ... I hope someone understands my problem, appreciates every help < P> You can set an obstacle on the filter one to take the stars, and then place it before the other one. This poll_id will fall through one.
Explanation:
Show original page for selected polling
abstract :
Local Host: 3000 / poll /: category_slug /: poll_id
Example:
Localhost: 3000 / election / Technology / 1337
route. RB
'election' /: category_slug /: poll_id '= & gt; 'Election #Show' ,: Like: & gt; : Election
Explanation:
Show a list of elections that match the selected criteria
Abstract:
example:
< Code> Localhost: 3000 / pole / technology / top
routes.rb
found 'Polls /: category_slug /: filter_mode' = & gt; 'Filter # by_mode',: like = & gt; : Poll_filter
And here is the problem ActiveRecord :: RecordNotFound: the election with ID = top_all was not found
The second path ( 'polls /: category_slug /: filter_mode' ) is overwriting the first route, so the rail should serve as a
as
: filter_mode Identifies: poll_id .
So my question is, how can I change this behavior, so both ways can actually work without overwriting each other? (The first route works when I'm out of the other)
Comments
Post a Comment