Skip to content

Infer model from the scope #183

@brendon

Description

@brendon

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions