Does anybody know how to fix this issue:
https://github.com/rails/rails/issues/4677 ?
It seems so basic and yet there is no clean solution like conditional eager
loading, something like:
Shift.includes(:schedules).where(:schedules => { :occurs_on => Date.today })
Or another solution would be threw a join request like:
SELECT shifts.*,schedules.* from shifts LEFT JOIN schedules ON
(schedules.shift_id = shifts.id AND schedules.occurs_on = Date.today);
But using this in a Shift.joins("LEFT JOIN schedules ON (schedules.shift_id
= shifts.id AND schedules.occurs_on = ?", Date.today) fails to return a
properly filled Shift arrays. And any access to the Shift.schedules launch
a new SQL request forgeting the occurs_on constraint...
Thanks for any help
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/tlvdnKOgj-cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.