Ruby on Rails Wednesday, November 28, 2012

Thanks Rahul. If possible could you explain any more cases as I faced. It would be helpful.

Regards
Sumit Srivastava

The power of imagination makes us infinite...


On 28 November 2012 15:32, rahul chandra <richesrahul@gmail.com> wrote:
well for understanding, If you add a symbol like(:city) in the routes it takes that as a variable and whenever you call that route you have to pass a variable like "list_users_path(:city)" or "/users/(:city)".


On Wednesday, November 28, 2012 2:12:12 PM UTC+5:30, Sumit Srivastava 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"}.

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/-/jzUDOS-PgWQJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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