Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7654077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:11:21+00:00 2026-05-31T12:11:21+00:00

My ability model for cancan has been working well for 6+ months now. One

  • 0

My ability model for cancan has been working well for 6+ months now. One of the controllers that has been around all that time is the QuestionsController. I recently added another controller, model and index page. The controller name is QuestionsBasicsController. In my ability model i have:

if user.permission >= 8 # admin
  can :manage, [Question, QuestionsBasic]
end

At the top of QuestionsController and QuestionsBasicsController i have:

load_and_authorize_resource

I am able to access the index page for both QuestionsController and QuestionsBasicsController on my development machine. After I uploaded the ability model to my server i restarted the server. I can access the index page for Question but not for QuestionsBasic on my server. On my development machine i have ruby 1.9.2 while on my server i have 1.8.7. Could it be the Ruby version difference?

UPDATE: for what it is worth names of models that begin with the name of another model cause a problem,… at least with the way I have constructed my ability model. In addition, I recently found another model name that worked fine but for CanCan. I think it may have been a reserved word but am not positive on that. When I changed the name of the model, controller, route and code to a new name it passed CanCan. No reflection on CanCan though… I think it is AWESOME, AWESOME, AWESOME! Thanks, Ryan Bates!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:11:22+00:00Added an answer on May 31, 2026 at 12:11 pm

    agree with dleatham, try splitting your original statement into 2 lines:

    if user.permission >= 8 # admin
      can :manage, Question
      can :manage, QuestionsBasic
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The ability to let the model handle its own validation has lead me to
My ability model looks something like this: class Ability include CanCan::Ability def initialize(user) if
WCF has a rich security model, I hope everyone can agree upon that as
When scaffolding controllers it will create tests for that model, do the test have
I have the following abilities model: class Ability include CanCan::Ability def initialize(user) user ||=
The ability to use BitKeeper free of charge had been withdrawn by the copyright
Since Git has the ability to keep track (and keep it clean) of branches
I love NHibernate's ability to have one table to store multiple types based on
Freemarker has the ability to do text escaping using something like this: <#escape x
I am having trouble with defining a CanCan ability over a HABTM relationship such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.