I am using Devise and CanCan in my rails application. My problem is that I want to make a particular action (basket_public_url
) for a particular controller (BasketsController
) public. I know how to skip controllers for authorization. Is there a way around?
https://github.com/ryanb/cancan/wiki/Ensure-Authorization#conditionally-check-authorization
If you want to skip login, this means you want to bypass both authentication and authorization.
class BasketsController < ApplicationController
skip_before_action :authenticate_user!, :only => :basket_public_url
skip_authorize_resource :only => :basket_public_url
end