You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ActiveRecord: preload for has_many through with source_type provided fails if has_many through association without source_type was specified in preload earlier.
#49355
Open
EnotPoloskun opened this issue
Sep 22, 2023
· 2 comments
ActiveRecord::AssociationNotFoundError: Association named 'card' was not found on Check; perhaps you misspelled it?
System configuration
Rails version: 7.0.8 Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered:
EnotPoloskun
changed the title
ActiveRecord: Preload for has_many through with source_type provided fails if has_many through association without source type was specified in preload earlier.
ActiveRecord: preload for has_many through with source_type provided fails if has_many through association without source_type was specified in preload earlier.
Sep 22, 2023
I believe that potential workaround for that issue is defining scoped association for has_many through to use. E.g in my example Invoice model should be changed to following
Steps to reproduce
Expected behavior
Should return first invoice with preloaded associations provided in
preload
same way howdoes. Order inside
preload
must not matter.Actual behavior
Following error is raised:
System configuration
Rails version: 7.0.8
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: