Why don’t you want to create another table? Your data model seems to necessitate it. I would recommend avoiding database-specific solutions when a Rails-based one (adding another model) would be more universal and is trivially supported.
How to store value pairs in Rails 4 (postgres db)
-
20-07-2023 - |
Question
I'm trying to store two types of product identifications together, one for each product color for each product.
I want to do this without creating another table, just by storing a set of id pairs. My form looks like this:
How can i submit and store this data in a consistent way? Is Hstore a good alternative for this?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow