-
Notifications
You must be signed in to change notification settings - Fork 897
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
Make direct_vms a relation #19201
Make direct_vms a relation #19201
Conversation
dbfa2c4
to
27a9d11
Compare
@kbrock do you mind putting in the steps on how or where you did the test to determine this? I am sure this probably is a bug, but it would be nice to have some proof on how to replicate in the future in case this causes a regression. Otherwise it looks good to me. |
The older versions of virtual attributes just ate errors (as we've complained about in a number of PRs) |
wip: determining if this is indeed a problem |
@NickLaMuro thanks for this comment. I'll change something in virtual attributes. The definition of
preload was made for associations. |
via @jrafanie lets add virtual has many: virtual_has_many :direct_vms |
A little mixed on this one. Don't want people using direct_vms, but we have code that preloads direct_vms and that only works if direct_vms is an association. in the end, the preload doesn't do anything but we felt it was safer to make the preload work than to just remove it. (to be honest, I was leaning towards removing it but agree that it would be a scary proposition for others)
Checked commit kbrock@92401ca with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
You can
preload
a relation.You can not
preload
a method.Older code in
virtual_attributes
andrails
was more lenient and would not complain.Newer versions of the gems are more picky.
We have 2 options:
preload
.direct_vms
to avirtual_has_many
. <== we chose thisLJ was more comfortable converting it to a virtual relation.