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

Add a default queryset macro #23

Open
ellmetha opened this issue Nov 14, 2021 · 0 comments
Open

Add a default queryset macro #23

ellmetha opened this issue Nov 14, 2021 · 0 comments

Comments

@ellmetha
Copy link
Member

Description

Right now the only way to customize the default queryset of a specific model is to override the ::default_queryset class method as follows:

class MyModel < Marten::Model
  def self.default_queryset
    super.filter(foo: "bar")
  end
end

It would be more convenient for simple cases (like in the above example) to rely on a ::default_queryset macro allowing to define the default queryset in a very simple way:

class MyModel < Marten::Model
  default_queryset { filter(foo: "bar") }
end
@ellmetha ellmetha added this to the v0.2.0 milestone Oct 29, 2022
@ellmetha ellmetha removed this from the v0.2.0 milestone Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant