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

Can preload has_one associations with existing records #553

Conversation

matthewmcgarvey
Copy link
Member

Part 2 of #531

Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. One thing I just thought of, I don't see any specs to check that you can skip the preloads using the bang method (or am I just missing them?)

admin = AdminBox.create
sign_in_credential = SignInCredentialBox.create &.user_id(admin.id)

admin.sign_in_credential!.should eq sign_in_credential

@matthewmcgarvey
Copy link
Member Author

@jwoertink I found a whole file file of specs for that feature https://github.com/luckyframework/avram/blob/master/spec/lazy_loading_spec.cr

@jwoertink
Copy link
Member

Oh good! 😅 These specs are all over the place lol. That works for me then.

@matthewmcgarvey matthewmcgarvey merged commit ad871ba into luckyframework:master Dec 3, 2020
@matthewmcgarvey matthewmcgarvey deleted the has-one-existing-record branch December 3, 2020 17:36
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.

2 participants