Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise not generating registration paths/ routes

I have created a new project using devise login according to Ryan Bates' railscast. It does not have the registration routes (unlike a previous project I made, with exactly the same steps)

This image shows the two 'rake routes' commands. The top shell is my previous project that works flawlessly and the bottom is the new project.

Is there any logical reason that it didn't create the routes properly? Can I add the routes? How do I make it work?

EDIT: Here is my routes.rb file, identical to a working devise project, standard comments removed.

Clubadmin::Application.routes.draw do
  #added by devise
  devise_for :users
  #added by me for home page
  root :to => "home#index"
  #And I don't like RESTful apps.
  match ':controller(/:action(/:id(.:format)))'
end
like image 290
Will Richardson Avatar asked Oct 26 '11 07:10

Will Richardson


2 Answers

Make sure to have in your User model the following:

devise :registerable

If not present, devise will not generate registration routes for you.

More information in here and here

like image 149
fuzzyalej Avatar answered Nov 19 '22 19:11

fuzzyalej


Ok, I can't see why the version Ryan Bates uses would not work twice, but I installed devise 1.4.9 and followed the installation briefly outlined here.

To make the logout link work I had to change the path type from :delete to :get in config/initializers/devise.rb

config.sign_out_via = :delete

to

config.sign_out_via = :get

And it has worked twice so far.

like image 1
Will Richardson Avatar answered Nov 19 '22 19:11

Will Richardson