Rails routes looking for show action

Posted by user1334345 on Stack Overflow See other posts from Stack Overflow or by user1334345
Published on 2012-04-15T10:00:12Z Indexed on 2012/04/15 11:28 UTC
Read the original article Hit count: 183

Filed under:
|
|

I am pretty new to rails and basically I want to make a user registration form.

I am currently using rails 3.2.3

Basically I want to make basic routes like user/register on top of basic REST route for user.

Here are my routes.rb

resources :user do
  collection do
    get 'register'
  end
end

And here are my rake routes:

     register_user_index GET    /user/register(.:format)   user#register
     user_index GET    /user(.:format)            user#index
                POST   /user(.:format)            user#create
       new_user GET    /user/new(.:format)        user#new
      edit_user GET    /user/:id/edit(.:format)   user#edit
           user GET    /user/:id(.:format)        user#show
                PUT    /user/:id(.:format)        user#update
                DELETE /user/:id(.:format)        user#destroy

From my understanding, since register user is on top of show, it should match with register first before going to show.

However, when I try to do localhost:3000/user/register, it gives me this error:

No route matches {:action=>"show", :controller=>"user"}

Can somebody help me with this?

Thanks!!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes