I have the following code in my routes.rb:
match 'users/linkedin' => "users#linkedin", :as => :register_linkedin
My expectation is that when I have a redirect_to register_linkedin_url, I will be redirected to domain.com/users/linkedin.
That should then result in Controller Users with action linkedin being executed.
This is what I get in the logs:
Redirected to
http://localhost:3000/users/linkedin
Completed 302 Found in 28333msStarted GET “/users/linkedin” for
127.0.0.1 at Thu Apr 14 01:12:01 -0700 2011 Processing by
UsersController#show as HTML
Parameters: {“id”=>”linkedin”}
Completed in 94ms
This is what I get in ‘rake routes’:
register_linkedin
/users/linkedin(.:format)
{:action=>”linkedin”,
:controller=>”users”}
So the routes aren’t working properly. How do I address this?
it’s because you’re probably using
resources :usersin your routesif you want to keep your
showaction, and use the linkedin part too, put your custom route before theresources :usersdoing that, routing will match
linkedinif the request is specific (users/linkedin) and if not, will continue searching and the next one will beshowof courseread more about routing in general here