You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
When I now visit the index action (has a raise "test" in it so it does nothing), I see in my rails sql log:
User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", "17"]]
Customer Load (27.0ms) SELECT "customers".* FROM "customers" WHERE "customers"."account_id" = 17
As you can see the it loads all customers of the current account, which is really bad for performance. Shouldn't it by default load anything but only create a scope and store this in @customers?
The text was updated successfully, but these errors were encountered:
It comes from a .respond_to?(:accessible_by) called on the collection.
As @ryanb said, we might need to do a scoped, but only with ActiveRecord 3. This is not relevant with AR 4, which have remove the `scoped' method.
yan13to
pushed a commit
to paupauorg/cancan
that referenced
this issue
May 30, 2017
Using rails 3.1.0.rc4 and cancan 1.6.5. My controller contains a simple
When I now visit the index action (has a raise "test" in it so it does nothing), I see in my rails sql log:
As you can see the it loads all customers of the current account, which is really bad for performance. Shouldn't it by default load anything but only create a scope and store this in @customers?
The text was updated successfully, but these errors were encountered: