Skip to content
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

Infer model from the scope #183

Open
brendon opened this issue Dec 7, 2017 · 0 comments
Open

Infer model from the scope #183

brendon opened this issue Dec 7, 2017 · 0 comments

Comments

@brendon
Copy link

brendon commented Dec 7, 2017

Currently if I have:

expose :thing, parent: :current_user
# equivalent to:
expose :thing, scope: ->{ current_user.things }

thing needs to have the model class Thing or things blow up. We can't use the :model configuration with :parent because apparently that doesn't make sense so we're forced to use the more verbose :scope method instead in order to additionally override the :model.

In more complicated systems sometimes the model class name is not the same as the the relationship name. Is it conceivable that we could better infer the model name directly from the scope? Do you think this is a good idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant