Closed mgorman42 closed 7 years ago
Please follow the issue template and provide a failing example. Thank you!
I added a more specific example, thanks for the response.
Okay, while making the gist I think I figured out what is going on. it looks like the issue was that the array was an array of integers [12345, 54321]. but the value on the object was a string "12345", and the comparison wasn't working right, going to re-factor the phonecodes array to be strings
Thanks for your help.
Glad I could help
have a ability
can :manage, StopBlacklist, phone_code: phonecodes That I know is getting hit for a given user
phonecodes is a list of phone_codes the user can mange stop blacklists for and phone_code is the column on the table for stop blacklist
when I run accessible_by it returns the array of stop blacklist the user should be able delete as expected
but when I run can? on a specific one in that list it run me false
I even tried to do the following
and it returned false
I am using Cancancan version (1.17.0) and Rails 4.0
Is there a reason using an array for the condition breaks checking on a single object?
EDIT
failing example
if phonecodes for the active user is [12345, 54321]
and there is a StopBlacklist with the values
id: 25 cell: 15555555555 phone_code: 12345
I would expect
to return true, but it is returning false
but if I do
I find the StopBlacklist object with id 25 in the returned list