Ask A Question


You’re not receiving notifications from this thread.

CanCanCan: Defining Abilities

Sascha M. asked in General

I'm using the CanCanCan gem. According to the documentation you can define abilities. That is working for me. What I want to do is to limit the access to records, that contain a value. Something like:

"can :crud, Order, :brand == nil"

is not working

A User should only be allowed to see the record, if the brand-column of the Order table is empty. As my example doesn't work apparently.. How would you do it?

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 79,047+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.