user470763
user470763

Reputation:

ActionController::RoutingError (No route matches [GET] "/users/sign_up")

I'm using devise to manage user accounts in my rails app. It has been working well in my development environment. I just pushed to Heroku and am getting "The page you were looking for doesn't exist" when I navigate to the /users/sign_up page (users/sign_in is working). I checked the logs and get:

ActionController::RoutingError (No route matches [GET] "/users/sign_up")

My routes.rb is:

  get "home/index"

  get "deals/new"
  get "deals/all"

  resources :deals

  devise_for :users

  root :to => "home#index"

Any idea what's going wrong?

Thanks

UPDATE:

The routes are:

              home_index GET    /home/index(.:format)          home#index
               deals_new GET    /deals/new(.:format)           deals#new
               deals_all GET    /deals/all(.:format)           deals#all
                   deals GET    /deals(.:format)               deals#index
                         POST   /deals(.:format)               deals#create
                new_deal GET    /deals/new(.:format)           deals#new
               edit_deal GET    /deals/:id/edit(.:format)      deals#edit
                    deal GET    /deals/:id(.:format)           deals#show
                         PUT    /deals/:id(.:format)           deals#update
                         DELETE /deals/:id(.:format)           deals#destroy
        new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
            user_session POST   /users/sign_in(.:format)       devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
           user_password POST   /users/password(.:format)      devise/passwords#create
       new_user_password GET    /users/password/new(.:format)  devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                         PUT    /users/password(.:format)      devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
       user_registration POST   /users(.:format)               devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                         PUT    /users(.:format)               devise/registrations#update
                         DELETE /users(.:format)               devise/registrations#destroy
                    root        /                              home#index

UPDATE:

I rake rake routes on heroku and the results were very different.

home_index GET    /home/index(.:format)     home#index
 deals_new GET    /deals/new(.:format)      deals#new
 deals_all GET    /deals/all(.:format)      deals#all
     deals GET    /deals(.:format)          deals#index
           POST   /deals(.:format)          deals#create
  new_deal GET    /deals/new(.:format)      deals#new
 edit_deal GET    /deals/:id/edit(.:format) deals#edit
      deal GET    /deals/:id(.:format)      deals#show
           PUT    /deals/:id(.:format)      deals#update
           DELETE /deals/:id(.:format)      deals#destroy
      root        /                         home#index

It seems devise isn't being setup. What am I doing wrong?

Upvotes: 1

Views: 7915

Answers (5)

boakye_wozniac
boakye_wozniac

Reputation: 37

in your routes.rb file add :

     resource:users

After that do rake routes to see if it exist.

Upvotes: 0

user470763
user470763

Reputation:

In the devise user model :registerable was not set for the production environment, but it was for the local one. That's why it worked locally and wouldn't on Heroku.

Upvotes: 2

Kyle C
Kyle C

Reputation: 4097

devise_for :users, :path_names => {
   :sign_in => 'signin',
   :sign_out => 'signout',
   :sign_up => 'signup'
  },

Upvotes: 0

Robert Chuchro
Robert Chuchro

Reputation: 127

Sorry I overlooked the whole point that you are using devise. I think the sign up route is supposed to be '/registration/sign_up'

to define your own route, try this in routes.rb

devise_scope :user do
  get "/sign_up" => "devise/registrations#new"
end

Upvotes: 0

Robert Chuchro
Robert Chuchro

Reputation: 127

I'm not sure what kind of things are supposed to work for default with a "users" model and "sign_up", but if you have a controller method called sign_up then you can add

get "users/sign_up"

to routes.rb

If the method you want to use for sign_up is called something like "create", then try

match 'sign_up', :to => 'users#create'

Upvotes: 0

Related Questions