error while using cancan in ruby: "uninitialized constant CanCan::Rule::Mongoid"

Posted by Ran on Stack Overflow See other posts from Stack Overflow or by Ran
Published on 2010-12-25T13:07:29Z Indexed on 2010/12/26 5:54 UTC
Read the original article Hit count: 291

Filed under:
|
|

here is my controller:

class AdminController < ApplicationController
  before_filter :require_user
  authorize_resource :class => false

  def index
  end

  def users_list
  end

end

here is my Ability class:

class Ability
  include CanCan::Ability

  def initialize(user)
    if user.admin?
      can :manage, :all
    else
      can :read, :all
    end
  end
end

when trying to access "/admin/users_list" (with an admin user or without) i get the following error:

uninitialized constant CanCan::Rule::Mongoid

any thoughts?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about authorization