I am having a Property model that should contain multiple values (just Strings). With Rails/ActiveRecord it seems that I have to create a new model (and a new table) for those values (like PropertyValue). As every one of those values just stores one String the PropertyValue only need one attribute (like value).
I don’t like that idea cause to access one of those values I now have to call property.values[0].value and that looks a bit ugly.
Is there a nicer solution?
I am having a Property model that should contain multiple values (just Strings). With
Share
Try
serializemethodvaluearray will be stored as string inpropertiestable and you can access it as normal array:property.value[3].More details in docs.