I have the following in my ability model :
class Ability
include CanCan::Ability
#...
def superuser_rules
can :access, :items
cannot :update, :items
can :update, :items, :foo_attributes
end
end
I have a form which mirrors that by only displaying the foo_attributes nested form.
However, when submitting the form, it says the access is denied to update the item.
Is there a way to circumvent this without adding new routes/actions ?
Many thanks !
You can create new actions to handle these “special attributes”.
First you can clean up the special attributes of the
params.Then you create a special action to change a special attribute:
Now you can set different permissions for
create,update, andacceptactions.Take a look at this too