Ruby on Rails Wednesday, November 28, 2012




On Wed, Nov 28, 2012 at 4:42 PM, Sumit Srivastava <sumit.theinvincible@gmail.com> wrote:
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"}.

Where do you get this error?  How are you calling the route?  Do you get the error
if you go to localhost:3000/users/my_city?  I don't see any error with this route.
show the code that produces the error and we'll go from there.

Btw, you should be able to call that route like this

list_users_path('my_city')
 

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.
 
 



--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment