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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:39:05+00:00 2026-06-09T17:39:05+00:00

I have the current database estructure in my application: Publisher has_many videos, has_many users

  • 0

I have the current database estructure in my application:

Publisher has_many videos, has_many users
Video      belongs_to publisher
User       belongs_to publisher

I want to be able to give permissions to the users based on the publisher, but the object that actually gets edited it’s the video object.

Meaning that an User X can edit videos from publisher 1 and 2 but User Y can only edit videos from publisher 2 and 3 and so on. I’m pretty sure this can be done with the CanCan, Devise, Rolify combo.

Can anyone point me in the right direction here?

  • 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-06-09T17:39:07+00:00Added an answer on June 9, 2026 at 5:39 pm

    sorry for the delayed response. Hopefully you’ve figured out your problem by now, but I will provide a solution for you.

    In your CanCan ability you have something like this:

    def initialize(current_user) 
      current_user ||= User.new
    
      can :update, Video do |video|
        current_user.publisher_list.contains? video.publisher
      end
    end
    

    The above code will work if user.publisher_list returns a list of publishers a user can modify. I believe you can also do:

    def initialize(current_user)
      current_user ||= User.new
    
      can :update, Video, publisher: {id: current_user.publisher_list}
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database i want to select data from data base of current
We have this current database which we need to replace some tables by anther
Suppose I am building an app using current mysql database tables. I have this
Current I have a seperate maven module for my database access, all my DAO
I have the current time format returned from the web service: 2012-06-25T23:45:52.664Z I want
I have my current location fixed via CoreLocation. Now I want to get those
I have the current PHP: $thisarray[] = #000; SetProfileField('usercss', $USER->id, implode(',',$thisarray)); Which writes #000
I'm trying to design database structure for personal finance application. Basically I'll have Transactions
I have an Android application that installs a database (~2000 rows across all tables)
my current database structure is that I have places that consist of many tags.

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.