storing a hash in the data base

Gady,

This is a perfect area where Ruby can work its magic. Here's an
example of what you could do:

class Element < ActiveRecord::Base    has_many :variables

   def (name)      variables.find_by_name(name)    end

   def =(name,value)      var = variables.find_or_create_by_name(name)      var.value = value      var.save    end end

class Variable < ActiveRecord::Base    belongs_to :element end

Now you will be able to do the following:

e = Element.create e["x"] = 800 e["y"] = 600 e["whatever"] = "anything"

e["x"] #-> "800" e["y"] #-> "600" e["whatever"] #-> "anything"

Isn't that fantastic? Note that this is assuming that your value field
is a TEXT which will return anything as a string. You could also store
a type and coerce the values, let me know if you want more detail.

Michael Bleigh michael@intridea.com