storing a hash in the data base

Hi Gady,

Another (much lighter) way of doing this is with the
'serliaze'declaration, that serializes hashes or arrays automagically.

class Element < ActiveRecord::Base
   serialize :variables
end

Then you can just do setters with:

element.variables = {:price => '4', :availability => '7 Days'}
element.save

And the getter becomes:
element.variables[:price]

This way, you don't need additional classes, tables or relationships.

Matt

Sorry, forgot to mention that 'variables' must be a text attribute on
Element.