Question

Maybe there is something about the way cancan runs that is causing this. I have a page that shows a list - and each item in the list checks for authorisation. I am using a friendly slug on the User model.

I tried using load_and_authorize_resource find_by: :slug However, chrome throws an error - "This webpage has a redirect loop"

The console shows the following line being run multiple times

CACHE (0.0ms) SELECT COUNT(*) FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))) [["user_id", 21]]

It goes against the cache - but it really should not be running the same query over and over

Appreciate any help I can get.

Thanks!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top