Skip to content

can :create? with specific options #44

@asiniy

Description

@asiniy

How to do that in protector?

I tried to do that, but with no luck.

if Contractor.restrict!(current_user).can(:create, :kind_cd: 1)
  # some view code here

I tried

      if user.contractors.any?{ |c| c.kind_cd == 1 }
        can :create, kind_cd: lambda { |k| k == 0 }
      else
        can :create
      end

and other, but there isn't any success 😢

Do have protector any similar options?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions