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 3680514
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:35:07+00:00 2026-05-19T03:35:07+00:00

I am building a Rails 3 app and I am working on a design

  • 0

I am building a Rails 3 app and I am working on a design for a sophisticated user permissions tool where a Company user determines specific roles for each PM.

Imagine this scenario – the Company wants to establish specific roles over three types of data.

  • Project table
  • Client table
  • Corporate Account (i.e. Company table)

I am thinking of adding a Role polymorphic table with these fields:

  • user_id (the user this role applies to, unless all_users == true)
  • item type (such as “Project”, “Client”, or “Company”, unless all_items == true)
  • item id (as above)
  • role (such as “read”, “edit”, “destroy”, or even “custom”)
  • all_users (boolean: does this item’s role apply to all users)
  • all_items (boolean: does this user’s role apply to all items)
  • company_id (the company who ‘owns’ this role)

I feel that CanCan would be a nice lean way of accomplishing this, but here’s my question. 1. Is the above table a good way to do this? 2. Could CanCan tie in with this to create an effective solution?

  • 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-19T03:35:08+00:00Added an answer on May 19, 2026 at 3:35 am

    Your table seems like a sensible way to implement a very complicated authorization scheme, which seems to be what you’re after.

    As far as CanCan goes, yes it will tie in perfectly with this. All CanCan does is provide you with the ability to define authorization on actions, models, etc. according to certain criteria. These criteria could be anything (e.g. day of the month, etc.) but are usually tied to roles. So all you’ll have to do is specify the authorization rights according to the information in your Role table and the specific model instance that is going to be evaluated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a Rails app which creates a bookmarklet file for each user upon
I'm building a rails gallery app for a company that doesn't want to host
I am in the early stages of building an app using Rails 3. User
When building a rails app that allows a User to login and create data,
I'm currently building a Rails app, where a user can upload an mp3 and
I'm building a rails app that communicates with other servers via ftp. The user
I am currently working on building an Android app for my Rails backend. I
I'll be building a rails app that will basically serve user-uploaded files (not a
I am building an rails app and I want to secure the user's downloads.
I am working on building a rails app and right now I am struggling

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.