Ruby on Rails Wednesday, October 31, 2012

Il 31/10/12 15:22, IT Coobo Internal Team ha scritto:
> Cbapp::Application.routes.draw do
> resources :users
> root :to => 'users#index'
> match 'users/login' => 'users#login'
> end

rules order in routes.rb is important: users resource 'users/:id'
matches before 'users/login' so login is the id :)
you can invert the order of the rules or, better, use a member:

Cbapp::Application.routes.draw do
resources :users do
member do
get 'login'
end
end
root :to => 'users#index'
end

Take a look here:
http://guides.rubyonrails.org/routing.html#adding-more-restful-actions

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