Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
organisation_id != nil是否可以为具有通过哈希条件的用户定义 CanCan 能力?
organisation_id != nil
can :crud, User, :organisation_id => ?present?
您可以执行以下操作。这将只允许具有非空 organization_id 的用户进行 crud
can :crud, User.all do |user| user.organization_id.present? end