I want to model e-commerce product attributes that can be changed in run-time.
So for example, on the Create Product page, the user adds a certain product with attributes: color, size. And then adds some other product with different attributes: resolution, diagonal size. Basically the user is able to define new attributes at run-time.
How do I handle variable attributes in the product model? I'm used to relational databases where the fields of each table are defined a priori.
Edit: I'm using Mongoid. Let me be more specific. Let's say I have this product model:
class Product
include Mongoid::Document
field :title
field :description
field :price
# attributes not known yet ???
end
The other fields of the product are clearly defined in the model, but not the attributes. Perhaps Mongoid/MongoDB doesn't care whether they are defined in the model or not, and just adds them in the document?