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

Adding block override for preloading with has_one. #994

Merged
merged 1 commit into from
Dec 29, 2023
Merged

Conversation

jwoertink
Copy link
Member

Fixes #985

The has_many and belongs_to both have a preload override method that takes a block and passes in the BaseQuery object. The has_one was missing it.

This lets you do something like

class User < BaseModel
  table do
    has_one theme : Theme
  end
end

UserQuery.new.preload_theme(&.with_soft_deleted)

@jwoertink jwoertink merged commit 49f6ccb into main Dec 29, 2023
9 checks passed
@jwoertink jwoertink deleted the issues/985 branch December 29, 2023 22:10
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

Successfully merging this pull request may close these issues.

has_one is missing preload with a block
1 participant