According to all documentation, the :read
action is aliased to both :index
and :show
:
alias_action :index, show, :to =>
I posted this as an issue on GitHub. Ryan responded with the following:
Both the
:index
and:show
actions point to the:read
action. But when CanCan authorizes a parent resource it uses the:read
action directly which is why you're seeing this behavior.I think this has caused confusion before, so I will change the internal behavior to never use the
:read
action directly. Instead of a:parent
resource I'll change it to use:show
and for theaccessible_by
default I will use:index
instead of:read
. Thanks for bringing this to my attention.
https://github.com/ryanb/cancan/issues/302#comment_863142