-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Apply Scopes to Eager Loaded Modules #4625
Comments
I was able to apply scopes, but it appears to only work for where clauses. Attribute filters do not seem to work. User.scope(['json']).findById(user.id, {
include: [{
model: Role.scope('json')
}]
}) |
That might actually not be supported. A solution could be to build in support for /cc @janmeier |
Its in the unit tests, but only seems to apply to some scope types
|
|
Or actually it should copy attributes here: Line 2411 in 538a095
|
I am trying to write a scope that returns select number of fields for serialization.
This works in combination with
user.get({ plain: true})
to produce a valid serialized object for exposing via an API. However, I cannot seem to find a way to to apply scopes to eagerly loaded models.Tried
Does not apply any scope
And specific scopes
Throws an error.
Is there is a there no way to apply scopes to eagerly loaded objects?
The text was updated successfully, but these errors were encountered: