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
In Rails 6, the signature of the methods build, create, and create! for AssociationRelation changed so that they no longer accept *args, but rather accept only 1 argument.
This causes an ArgumentError to be raised when using methods like first_or_initialize on an AssociationRelation. I had never heard of this class before, but apparently it is the class that you get when you chain a where onto an association method, like: user.comments.where("1=1").
I have reproduced this issue with the following script:
I fixed this at my job by adding a patch to AssociationRelation. If it's alright, I would like to upstream that patch to this gem. I can raise a PR if that sounds like a good idea.
The text was updated successfully, but these errors were encountered:
In Rails 6, the signature of the methods
build
,create
, andcreate!
forAssociationRelation
changed so that they no longer accept*args
, but rather accept only 1 argument.This causes an
ArgumentError
to be raised when using methods likefirst_or_initialize
on anAssociationRelation
. I had never heard of this class before, but apparently it is the class that you get when you chain awhere
onto an association method, like:user.comments.where("1=1")
.I have reproduced this issue with the following script:
I fixed this at my job by adding a patch to
AssociationRelation
. If it's alright, I would like to upstream that patch to this gem. I can raise a PR if that sounds like a good idea.The text was updated successfully, but these errors were encountered: