Reputation: 1776
I want to do something that I imagine looks like this:
resources :users do
collection do
get 'login', :action => 'login_form'
post 'login', :action => 'login'
get 'logout'
end
end
I.e. I want two controller actions to bind to the same path with different methods. How do I do that?
Upvotes: 0
Views: 172
Reputation: 21884
You should read the guide about routes: http://guides.rubyonrails.org/routing.html
resources :users do
collection do
match 'login' => "users#login_form", via: :get
post 'login'
get 'logout'
end
end
A login_form
action does not sound very restful. Just saying ;)
Upvotes: 1