cancancan
cancancan copied to clipboard
Undefined Method exception when block is passed with curly braces
when:
can :update, Note { |note| note.writer_id == user.id }
CanCan handle undefined method exception (undefined method Note' for #Abilities::ExampleAbilitie:0x000055d5ebc6fe50 )
when:
can :update, Note do |note| note.writer_id == user.id end
works fine
System configuration
Rails version:
6.1.3.2
Ruby version:
2.6.4
CanCanCan version
3.2.0
Can't help, but find your post very useful nonetheless. I was looking in the docs if passing a block is at all possible and couldn't find anything. I'm fine with writing do ... end