ruby - Rails 3 - overwriting routes -


I'm currently having some problems setting up the right path for my application. URLs like:

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

In addition, the user should be able to filter the elections against certain criteria such as show top-poll, new-pole And so ... ...
Explanation:
Show a list of elections that match the selected criteria
Abstract:
Host: 3000 / election /: category_slge /: filter_mode
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)

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.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -