Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can :create? with specific options #44

Open
asiniy opened this issue Apr 11, 2014 · 4 comments
Open

can :create? with specific options #44

asiniy opened this issue Apr 11, 2014 · 4 comments

Comments

@asiniy
Copy link
Contributor

asiniy commented Apr 11, 2014

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?

@inossidabile
Copy link
Owner

I don't really understand what you are trying to achieve. Can you please explain what is your goal and not how you are trying to get there?

@asiniy
Copy link
Contributor Author

asiniy commented Apr 27, 2014

I try to work with can? method.

How can I check that somebody can create something just with special options? (Like kind_cd = 1)

@inossidabile
Copy link
Owner

Oh. Protector is not currently available to do that. That would be nice to have such feature so I'll leave this open.

@asiniy
Copy link
Contributor Author

asiniy commented Jun 10, 2014

ok.

I'll try to do that feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants