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
However I have a model that has a field/attribute called map. When this model is an association it doesn't get serialized properly.
The association gets put in included fine, but in the relationships key I get the value of the map attribute:
And this cannot be properly parsed, and the relationship is lost. This was a particularly difficult issue to debug, mostly because all the values of my map property while I was trying to debug this were nil. So it wasn't clear it was a bug at first. I spent a couple of hours trying to figure out what was wrong with MY code. It was only after reading your source code that I was able to work out the problem. I'm surprised no one else has had this issue.
Do you have a recommended workaround for this?
Also I suspect that it is not your intention to require models to not have attributes or methods named map. Ideally this could be changed rather quickly in your source code. Otherwise, I'll have to rename the attribute in a rather large application, made harder by the fact that the native iterator map is also used extensively, so a big mess really.
The text was updated successfully, but these errors were encountered:
The following method in
relationship.rb
uses a check forrespond_to? :map
to determine whether an association is plural or not:However I have a model that has a field/attribute called
map
. When this model is an association it doesn't get serialized properly.The association gets put in
included
fine, but in therelationships
key I get the value of themap
attribute:And this cannot be properly parsed, and the relationship is lost. This was a particularly difficult issue to debug, mostly because all the values of my
map
property while I was trying to debug this werenil
. So it wasn't clear it was a bug at first. I spent a couple of hours trying to figure out what was wrong with MY code. It was only after reading your source code that I was able to work out the problem. I'm surprised no one else has had this issue.Do you have a recommended workaround for this?
Also I suspect that it is not your intention to require models to not have attributes or methods named
map
. Ideally this could be changed rather quickly in your source code. Otherwise, I'll have to rename the attribute in a rather large application, made harder by the fact that the native iteratormap
is also used extensively, so a big mess really.The text was updated successfully, but these errors were encountered: