search for: data_properties

Displaying 1 result from an estimated 1 matches for "data_properties".

2006 Oct 10
3
Dynamic fields and inheritance
I have a model that allows subclasses to dynamically define fields. The following code is a short test case that illustrates the problem I''m having: class Product < ActiveRecord::Base acts_as_ferret :fields => [:name] serialize :data def self.data_properties (*properties) properties.each do |property| define_method(property) {self.get_property(property)} define_method((property.to_s + ''='').to_sym) \ {|value| self.set_property(property, value)} end end def get_property (property) self[:data][propert...