title: Refinerycms + devise: custom user can't find the devise helpers (how to add a separate devise authentication)?
body: <p>I have a problem that doesn't seem so difficult at first, but actually I can't solve. 
  I'm trying to use Refinery as CMS for an application. I want to keep separate Refinery users and other kind of users, call them mktgeistusers that will need to register and login in order to access to some protected pages. So I created first an application without refinery (only with devise) to make sure that everything works (from the authentication side). No problems here. The next step was to create a brand new Refinery installation by doing the following:</p>
  
  <pre><code>refinerycms testRefineryPlusDevise  -d mysql 
  
  
  add other refinery gems to the Gemfile
  
  gem 'refinerycms-i18n', '~&gt; 2.0.0'
  gem 'refinerycms-blog', '~&gt; 2.0.0'
  gem 'refinerycms-inquiries', '~&gt; 2.0.0'
  gem 'refinerycms-search', '~&gt; 2.0.0', :git =&gt; 'git://github.com/refinery/refinerycms-search.git', :branch =&gt; '2-0-stable'
  gem 'refinerycms-page-images', '~&gt; 2.0.0'
  gem "refinerycms-news", '~&gt; 2.0.0'
  
  bundle update
  
  rails generate refinery:blog
  rails generate refinery:inquiries
  rails generate refinery:news
  
  rake db:migrate
  </code></pre>
  
  <p>Which creates everything as it should be. The problems starts when I go on and create the new kind of users:</p>
  
  <pre><code>rails generate devise Mktgeistuser 
  
        invoke  active_record
        create    db/migrate/20121019201721_devise_create_mktgeistusers.rb
        create    app/models/mktgeistuser.rb
        invoke    test_unit
        create      test/unit/mktgeistuser_test.rb
        create      test/fixtures/mktgeistusers.yml
        insert    app/models/mktgeistuser.rb
         route  devise_for :mktgeistusers
  
  rake db:migrate
  </code></pre>
  
  <p>The user is now created. Then I added a static page where to put the login/logout links to test and added the following routes:</p>
  
  <pre><code>  #devise_for :mktgeistusers
  
    devise_for :mktgeistuser, :controllers=&gt;{:sessions=&gt;"mktgeistuser/sessions"} do
      match '/mktgeistuser/sign_out', :action=&gt;"destroy", :controller=&gt;"devise/sessions"
      match '/mktgeistuser/sign_in',  :action=&gt;"new", :controller=&gt;"devise/sessions"
      match '/mktgeistuser/sign_up',  :action=&gt;"new", :controller=&gt;"devise/registrations"
    end
  
  
    root :to =&gt; "static#home"
  
  
  
   default of "refinery"
        mount Refinery::Core::Engine, :at =&gt; '/refinery'
  </code></pre>
  
  <p>In static/home there is this:</p>
  
  <pre><code>&lt;h1&gt;Static#home&lt;/h1&gt;
  &lt;p&gt;
      Find me in app/views/static/home.html.erb
  &lt;/p&gt;
  &lt;div id="user_nav"&gt;
      &lt;% if mktgeistuser_signed_in? %&gt;
      Signed in as &lt;%= current_mktgeistuser.email %&gt;.
      &lt;%= link_to "Sign out", destroy_mktgeistuser_session_path, :method =&gt; :delete %&gt;
      &lt;% else %&gt;
      &lt;%= link_to 'Register', new_mktgeistuser_registration_path %&gt; or &lt;%= link_to 'Sign in', new_mktgeistuser_session_path %&gt;
      &lt;% end %&gt;
  &lt;/div&gt;
  &lt;%= javascript_include_tag :defaults %&gt;
  </code></pre>
  
  <p>The problem is that when refinery is in play, the app can't find the Devise helpers for mktgeist user: when I click on the login/register links I get</p>
  
  <pre><code>NoMethodError in Devise/sessions#new
  
  Showing /home/mike/.rvm/gems/ruby-1.9.2-p290/gems/devise-2.0.4/app/views/devise/sessions/new.html.erb where line #3 raised:
  
  undefined method `mktgeistuser_session_path' for #&lt;ActionDispatch::Routing::RoutesProxy:0xdeb1d6c&gt;
  Extracted source (around line #3):
  
  1: &lt;h2&gt;Sign in&lt;/h2&gt;
  2: 
  3: 
  
  &lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; session_path(resource_name)) do |f| %&gt;
  4:   &lt;div&gt;&lt;%= f.label :email %&gt;&lt;br /&gt;
  5:   &lt;%= f.email_field :email %&gt;&lt;/div&gt;
  6: 
  </code></pre>
  
  <p>Similarly, destroy_mktgeistuser_session_path new_mktgeistuser_registration_path and new_mktgeistuser_session_path cannot be found. 
  Do you have an idea how to solve this? </p>
  
  <p>Btw, here's is a rake routes output</p>
  
  <pre><code>                         static_home GET    /static/home(.:format)                static#home
             mktgeistuser_sign_out        /mktgeistuser/sign_out(.:format)      devise/sessions#destroy
              mktgeistuser_sign_in        /mktgeistuser/sign_in(.:format)       devise/sessions#new
              mktgeistuser_sign_up        /mktgeistuser/sign_up(.:format)       devise/registrations#new
          new_mktgeistuser_session GET    /mktgeistuser/sign_in(.:format)       mktgeistuser/sessions#new
              mktgeistuser_session POST   /mktgeistuser/sign_in(.:format)       mktgeistuser/sessions#create
      destroy_mktgeistuser_session DELETE /mktgeistuser/sign_out(.:format)      mktgeistuser/sessions#destroy
             mktgeistuser_password POST   /mktgeistuser/password(.:format)      devise/passwords#create
         new_mktgeistuser_password GET    /mktgeistuser/password/new(.:format)  devise/passwords#new
        edit_mktgeistuser_password GET    /mktgeistuser/password/edit(.:format) devise/passwords#edit
                                   PUT    /mktgeistuser/password(.:format)      devise/passwords#update
  cancel_mktgeistuser_registration GET    /mktgeistuser/cancel(.:format)        devise/registrations#cancel
         mktgeistuser_registration POST   /mktgeistuser(.:format)               devise/registrations#create
     new_mktgeistuser_registration GET    /mktgeistuser/sign_up(.:format)       devise/registrations#new
    edit_mktgeistuser_registration GET    /mktgeistuser/edit(.:format)          devise/registrations#edit
                                   PUT    /mktgeistuser(.:format)               devise/registrations#update
                                   DELETE /mktgeistuser(.:format)               devise/registrations#destroy
                              root        /                                     static#home
                          refinery        /                                     Refinery::Core::Engine
  
  Routes for Refinery::Core::Engine:
                                                      /system/resources/*dragonfly(.:format)                    &lt;Dragonfly::App name=:refinery_resource
  s &gt;
                       insert_admin_resources GET     /refinery/resources/insert(.:format)                      refinery/admin/resources#insert
                              admin_resources GET     /refinery/resources(.:format)                             refinery/admin/resources#index
                                              POST    /refinery/resources(.:format)                             refinery/admin/resources#create
                           new_admin_resource GET     /refinery/resources/new(.:format)                         refinery/admin/resources#new
                          edit_admin_resource GET     /refinery/resources/:id/edit(.:format)                    refinery/admin/resources#edit
                               admin_resource PUT     /refinery/resources/:id(.:format)                         refinery/admin/resources#update
                                              DELETE  /refinery/resources/:id(.:format)                         refinery/admin/resources#destroy
                                                      /system/images/*dragonfly(.:format)                       &lt;Dragonfly::App name=:refinery_images &gt;
                          insert_admin_images GET     /refinery/images/insert(.:format)                         refinery/admin/images#insert
                                 admin_images GET     /refinery/images(.:format)                                refinery/admin/images#index
                                              POST    /refinery/images(.:format)                                refinery/admin/images#create
                              new_admin_image GET     /refinery/images/new(.:format)                            refinery/admin/images#new
                             edit_admin_image GET     /refinery/images/:id/edit(.:format)                       refinery/admin/images#edit
                                  admin_image PUT     /refinery/images/:id(.:format)                            refinery/admin/images#update
                                              DELETE  /refinery/images/:id(.:format)                            refinery/admin/images#destroy
                              admin_dashboard GET     /refinery/dashboard(.:format)                             refinery/admin/dashboard#index
                admin_disable_upgrade_message         /refinery/disable_upgrade_message(.:format)               refinery/admin/dashboard#disable_upgrad
  e_message
                                                      /system/resources/*dragonfly(.:format)                    &lt;Dragonfly::App name=:refinery_resource
  s &gt;
                                              GET     /refinery/resources/insert(.:format)                      refinery/admin/resources#insert
                                              GET     /refinery/resources(.:format)                             refinery/admin/resources#index
                                              POST    /refinery/resources(.:format)                             refinery/admin/resources#create
                                              GET     /refinery/resources/new(.:format)                         refinery/admin/resources#new
                                              GET     /refinery/resources/:id/edit(.:format)                    refinery/admin/resources#edit
                                              PUT     /refinery/resources/:id(.:format)                         refinery/admin/resources#update
                                              DELETE  /refinery/resources/:id(.:format)                         refinery/admin/resources#destroy
                                                      /system/images/*dragonfly(.:format)                       &lt;Dragonfly::App name=:refinery_images &gt;
                                              GET     /refinery/images/insert(.:format)                         refinery/admin/images#insert
                                              GET     /refinery/images(.:format)                                refinery/admin/images#index
                                              POST    /refinery/images(.:format)                                refinery/admin/images#create
                                              GET     /refinery/images/new(.:format)                            refinery/admin/images#new
                                              GET     /refinery/images/:id/edit(.:format)                       refinery/admin/images#edit
                                              PUT     /refinery/images/:id(.:format)                            refinery/admin/images#update
                                              DELETE  /refinery/images/:id(.:format)                            refinery/admin/images#destroy
                              admin_dashboard GET     /refinery/dashboard(.:format)                             refinery/admin/dashboard#index
                admin_disable_upgrade_message         /refinery/disable_upgrade_message(.:format)               refinery/admin/dashboard#disable_upgrad
  e_message
                                                      /system/resources/*dragonfly(.:format)                    &lt;Dragonfly::App name=:refinery_resource
  s &gt;
                                              GET     /refinery/resources/insert(.:format)                      refinery/admin/resources#insert
                                              GET     /refinery/resources(.:format)                             refinery/admin/resources#index
                                              POST    /refinery/resources(.:format)                             refinery/admin/resources#create
                                              GET     /refinery/resources/new(.:format)                         refinery/admin/resources#new
                                              GET     /refinery/resources/:id/edit(.:format)                    refinery/admin/resources#edit
                                              PUT     /refinery/resources/:id(.:format)                         refinery/admin/resources#update
                                              DELETE  /refinery/resources/:id(.:format)                         refinery/admin/resources#destroy
                                                      /system/images/*dragonfly(.:format)                       &lt;Dragonfly::App name=:refinery_images &gt;
                                              GET     /refinery/images/insert(.:format)                         refinery/admin/images#insert
                                              GET     /refinery/images(.:format)                                refinery/admin/images#index
                                              POST    /refinery/images(.:format)                                refinery/admin/images#create
                                              GET     /refinery/images/new(.:format)                            refinery/admin/images#new
                                              GET     /refinery/images/:id/edit(.:format)                       refinery/admin/images#edit
                                              PUT     /refinery/images/:id(.:format)                            refinery/admin/images#update
                                              DELETE  /refinery/images/:id(.:format)                            refinery/admin/images#destroy
                              admin_dashboard GET     /refinery/dashboard(.:format)                             refinery/admin/dashboard#index
                admin_disable_upgrade_message         /refinery/disable_upgrade_message(.:format)               refinery/admin/dashboard#disable_upgrad
  e_message
                                    news_root         /news(.:format)                                           refinery/news/items#index
                           news_items_archive GET     /news/archive/:year(/:month)(.:format)                    refinery/news/items#archive
                                   news_items GET     /news(.:format)                                           refinery/news/items#index
                                    news_item GET     /news/:id(.:format)                                       refinery/news/items#show
                              news_admin_root         /refinery/news(.:format)                                  refinery/news/admin/items#index
                             news_admin_items GET     /refinery/news/items(.:format)                            refinery/news/admin/items#index
                                              POST    /refinery/news/items(.:format)                            refinery/news/admin/items#create
                          new_news_admin_item GET     /refinery/news/items/new(.:format)                        refinery/news/admin/items#new
                         edit_news_admin_item GET     /refinery/news/items/:id/edit(.:format)                   refinery/news/admin/items#edit
                              news_admin_item PUT     /refinery/news/items/:id(.:format)                        refinery/news/admin/items#update
                                              DELETE  /refinery/news/items/:id(.:format)                        refinery/news/admin/items#destroy
                                       search         /search(.:format)                                         refinery/search#show
                        inquiries_new_inquiry GET     /contact(.:format)                                        refinery/inquiries/inquiries#new
                thank_you_inquiries_inquiries GET     /contact/thank_you(.:format)                              refinery/inquiries/inquiries#thank_you
                          inquiries_inquiries POST    /contact(.:format)                                        refinery/inquiries/inquiries#create
               spam_inquiries_admin_inquiries GET     /refinery/inquiries/spam(.:format)                        refinery/inquiries/admin/inquiries#spam
          toggle_spam_inquiries_admin_inquiry GET     /refinery/inquiries/:id/toggle_spam(.:format)             refinery/inquiries/admin/inquiries#togg
  le_spam
                    inquiries_admin_inquiries GET     /refinery/inquiries(.:format)                             refinery/inquiries/admin/inquiries#inde
  x
                      inquiries_admin_inquiry GET     /refinery/inquiries/:id(.:format)                         refinery/inquiries/admin/inquiries#show
                                              DELETE  /refinery/inquiries/:id(.:format)                         refinery/inquiries/admin/inquiries#dest
  roy
                 edit_inquiries_admin_setting GET     /refinery/inquiries/settings/:id/edit(.:format)           refinery/inquiries/admin/settings#edit
                      inquiries_admin_setting PUT     /refinery/inquiries/settings/:id(.:format)                refinery/inquiries/admin/settings#updat
  e
                                    blog_root         /blog(.:format)                                           refinery/blog/posts#index
                                    blog_post GET     /blog/posts/:id(.:format)                                 refinery/blog/posts#show
                                blog_rss_feed         /blog/feed.rss(.:format)                                  refinery/blog/posts#index {:format=&gt;"rs
  s"}
                                blog_category         /blog/categories/:id(.:format)                            refinery/blog/categories#show
                                blog_comments         /blog/:id/comments(.:format)                              
  </code></pre>
  
  <p>etc</p>
  
  <p>Thank you very much for any help or suggestion!</p>
  
  <p>BTW I'm using Devise 2.0.4  </p>