Wednesday, November 28, 2012

[Rails] Having two paths for a single action with different parameters

Hi,

I have a controller named users and index action in it. By default I have the path

get '/users' => 'users#index', :as => 'users'

Now I want to create one more path with a different parameter being passed

get '/users/:city' => 'users#index', :as => 'list_users'

But this gives as error, No route matches {:controller=>"users"}.

I ran rake routes and found the path I defined to be present over there but it doesn't works.

What shall be done to make this work.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/dGIZ5Q1zlyYJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate