class Product < ActiveRecord::Base attr_accessible :name, :price, :category, :descrption, :author serialize :data, ActiveRecord::Coders::Hstore def author properties && properties["author"] end def author=(value) self.properties = (properties || {}).merge("author" => value) end end