devise - Filter chain halted as :require_no_authentication rendered or redirected rails 4 -


in ability.rb:

def initialize(user)   user ||= user.new   if user.role? :agent     can :manage, servicerequest   elsif user.role? :punching_team     can :manage, srdocument   end 

in service_request_controller:

load_and_authorize_resource 

in sr_documents_controller:

load_and_authorize_resource 

in application_controller:

rescue_from cancan::accessdenied |exception|   redirect_to root_url, :alert => exception.message end 

in routes:

devise_scope :user   root to: "devise/sessions#new" end 

in log:

redirected http://localhost:3000/ filter chain halted :require_no_authentication rendered or redirected 

i using cancan gem in application.i want set authorization in such way if user 'agent' he/she should access servicerequest model , 'punching_team' type he/she should access srdocument model.but when login agent, getting infinite loop.which gives me errors `filter chain halted :require_no_authentication rendered or redirected.please me out.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -