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
I have a general question about creating a schema that has arrays and hashes in the model. If I understand some of this correctly I would need a has_many relationship for tags because this entity can have many tags. However, for my metadata how do I specify this as it will be a hash of key/value information. The remote Api will return JSON code with arrays and hashes so its unclear to me how to consume the data when the schema only supports primitive types.
CDQ does not offer any special support for hash or array. You can use a transformable type attribute and store a hash in there, and that's a common thing to do.
Depending on the shape of your data, though, the best and most reliable may be to do another has many with both a key and value column, and look them up like item.metadata.where(:key).eq("mykey").
Good luck. Native support for these is something I'd like to add in the future.
Ah, so its a limitation of core data and serialization. Ok so the has_many makes sense but what if I don't have a 1-to-many relationship like in metadata. Is there a one-to-one relationship? @kemiller
I have a general question about creating a schema that has arrays and hashes in the model. If I understand some of this correctly I would need a has_many relationship for tags because this entity can have many tags. However, for my metadata how do I specify this as it will be a hash of key/value information. The remote Api will return JSON code with arrays and hashes so its unclear to me how to consume the data when the schema only supports primitive types.
Example:
The text was updated successfully, but these errors were encountered: