Jason N. wrote:
I have a similar problem:
I’m creating a site which will have several clients, each of which
will have items in our catalog. The app will be customized as far as
layout for each client, but the data for the items needs to be in (at
least)three different formats as well, one of which is that the data
will be in the form of a scanned image.
For the different attributes, I was thinking of making an item_data
table like so
id int …
item id int
contents varchar or text
And then building my layout on that i.e.
<% for datum in @data %>
|<%= datum.name %>
|<%= datum.contents %>
<% end %>
I don’t know if this will work well, and I’m wondering if there is a
better way to solve dynamic attributes for an object.
I think what you are talking about is like the Entity-Attribute-Value
Design. See this site:
I actually came up with a simple version of that that worked in Rails,
but scrapped the idea because of all the reasons there are NOT to use
for some reasons). I’d be willing to share the code if you wanted to
I was thinking that maybe we don’t need the flexibility to the degree
that design would provide, since it’s really not that much work to add a
column in the database, or create a new table for a new Form type. I’m
just sure someone has done this before so I don’t want to re-invent the
wheel or anything.