Routing error with multiple models - devise rails
<p>Actually I am using two models for my app that is User and Admin and I followed every steps to be dealt while using devise gem.</p>

<p>And I would like to have multiple sign_up. When User sign_up, must be redirected to User sign_up page and when Admin sign_up, must be redirected to Admin sign_up page in order to make registrations.</p>

<p>When I execute sign_up link under User it gives me routing error which is as below;</p>

<pre><code>Routing Error
uninitialized constant Users::RegistrationsController
</code></pre>

<p>And When I execute sign_up link under Admin it gives me routing error which is as below;</p>

<pre><code>Routing Error
uninitialized constant Admins::RegistrationsController
</code></pre>

<p>routes.rb</p>

<pre><code>Rails.application.routes.draw do

    root "home#index"

    devise_for :users, controllers: {
        sessions: 'users/sessions',
        registrations: 'users/registrations'
    }   

    get '/aslani' =&gt; 'aslani#index', as: :authenticated_user_root

    devise_for :admins, controllers: {
        sessions: 'admins/sessions',
        registrations: 'admins/registrations'
    }


    get '/kola' =&gt; 'kola#index', as: :authenticated_admin_root
end
</code></pre>

<p>aslani/index.html.erb</p>

<pre><code>&lt;% if user_signed_in? %&gt;
      I am Aslani.
       &lt;%= link_to 'Log out', destroy_user_session_path, method: :delete %&gt;
    &lt;% else %&gt;
      &lt;%= link_to 'Log In', new_user_session_path %&gt;
      &lt;%= link_to 'Sign Up', new_user_registration_path %&gt;
&lt;% end %&gt;
</code></pre>

<p>kola/index.html.erb</p>

<pre><code>&lt;% if admin_signed_in? %&gt;
       I am Kola.
      &lt;%= link_to 'Log out', destroy_admin_session_path, method: :delete %&gt;
    &lt;% else %&gt;
      &lt;%= link_to 'Log In', new_admin_session_path %&gt;&lt;/li&gt;
      &lt;%= link_to 'Sign Up', new_admin_registration_path %&gt;
&lt;% end %&gt;
</code></pre>

<p>app/controllers/users/sessions_controller.rb</p>

<pre><code>class Users::SessionsController &lt; Devise::SessionsController
    def new
        super
    end

    def create 
        self.resource = warden.authenticate!(auth_options) 
        sign_in(resource_name, resource) 
        yield resource if block_given? 
        respond_with resource, location: after_sign_in_path_for(resource) 
    end

end
</code></pre>

<p>app/controllers/admins/sessions_controller.rb</p>

<pre><code>class Admins::SessionsController &lt; Devise::SessionsController
    def new
        super
    end

    def create 
        self.resource = warden.authenticate!(auth_options) 
        sign_in(resource_name, resource) 
        yield resource if block_given? 
        respond_with resource, location: after_sign_in_path_for(resource) 
    end

end
</code></pre>

<p>app/controllers/users/registrations_controller.rb</p>

<pre><code>class Users::RegistrationsController &lt; Devise::RegistrationsController
  def new
    super
  end

  def create 
        super
    end

  def update
    super
  end
end 
</code></pre>

<p>app/controllers/admins/registrations_controller.rb</p>

<pre><code>class Admins::RegistrationsController &lt; Devise::RegistrationsController
  def new
    super
  end

  def create 
         super
    end

  def update
    super
  end
end 
</code></pre>

<p>Any suggestions are most welcome.</p>

<p>Thank you in advance.</p>