Rails NameError (uninitialized constant Registration):

I am currently using Cancan and my users basically have different 'roles'. I only want people to be able to register 'consumer' user accounts and for business accounts admins will be doing that.

So now, I have this in my ability.rb

  def initialize(user)
    user ||= User.new  
    # You can only create accounts that are consumers
    can :create, User do |user|
      user.role? :consumer 

and in my controller/users/registrations_controller.rb

class Users::RegistrationsController < Devise::RegistrationsController

and config/routes.rb:

  devise_for :users, :controllers => { 
    :registrations => "users/registrations"

Now when I visit the registration page, I am seeing "uninitialized constant Registration" with NO stack trace whatsoever. Any ideas?


My code example

class ApplicationController < ActionController::Base

class Users::SessionsController < Devise::SessionsController

For load_and_authorize_resource you will need skip_load_and_authorize_resource. And all this code is applicable for custom devise's controller. Just create one.

The issue is with the routes, please follow the following steps

 1. $ rake routes, you will see the list of routes 

 2. In your config/routes.rb write the route you need, In my case the route to create a new user was,     
   devise_for :users,  :controllers => { :new_user_registration => "users/registrations#new" }
 3. restart rails server

Need Your Help

How can you show the navigation arrows in Flex slider 2?

jquery css flexslider

I want to use Flex slider 2 but I can not display the navigation arrows with hover. I read a lot of other answers, but I'm still not able to fix the problem.

Apache symlinks give 403 Forbidden

php apache

I have some projects in /home/novito/Projects that I want Apache to be able to serve.