0

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!

user2515011
  • 127
  • 1
  • 12
  • Can you post view, controller and model? Maybe you have an edit or delete link for every item, iterate over your list and ask every time if the current user can delete or edit? Must be something like that.. – Nikolai Manek Feb 10 '14 at 05:45
  • https://github.com/ryanb/cancan/issues/206 – user2515011 Feb 10 '14 at 06:19

0 Answers0