But how do you make sure devise looks in the devise dir for the views? I'm trying this but devise methods like "sign_in_and_redirect(resource_name, resource)" are looking in views for the template.
–
AnApprenticeNov 10 '10 at 4:23

4

If you want to customise your devise views, you just need to generate them first and devise will check your views folder before loading the views from the gem. In Rails 3 it's: rails generate devise:views and in Rails 2 (i think) it's: script/generate devise:views
–
theTRONNov 11 '10 at 22:19

2

the above hack doesn't work with devise 1.0.8 which is the version works for rails 2.
–
goodwillNov 19 '10 at 10:02

13

If you override a Devise controller like this, make sure you copy all views from app/views/devise/registrations to app/views/registrations/ (change for whichever controller you're overriding).
–
Jamie CobbettMar 21 '11 at 17:29

26

Alternatively you can leave your devise views where they are and add paths.app.views << "app/views/devise" in your config/application.rb.
–
theTRONMar 21 '11 at 21:21

This is similar to the approach I'm taking, but I don't know what custom logic to put in the create method of Devise's I overwrote. My scaffold-created controller that I modified works great, but how do you make it work with Devise's resource business?
–
Kyle CarlsonMay 26 '13 at 2:17

You can also make the folder devise in your controllers path and copy/paste the entire devise controller into it. This requires no additional configuration.

So for just the registrations controller it would be app/controllers/devise/registrations_controller.rb and then copy the devise registrations_controller.rb source into it. You can get it from github https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb, or you can track it down in your gem source, or if you use RubyMine when you type in the class line class Devise::RegistrationsController a globe like symbol appears to the left... click on it and it opens the Devise Registration Controller file for you. Then copy/paste.