search for: enum_class

Displaying 2 results from an estimated 2 matches for "enum_class".

Did you mean: elem_class
2005 Aug 16
1
Defining model classes for enumerations
...e'' if class_name.empty? order = spec[:order] || ''position'' table_name = spec[:table_name] || class_name else class_name = spec end module_eval("class #{class_name} < BoilerPlate::EnumRecord; end") enum_class = const_get(class_name) enum_class.table_name = table_name enum_class.preload(:order => order) # mixed-in somewhere else end end end Used like this in, say, environment.rb EnumRecord::define_enums( ''Status'', {:class_name => ''Criteri...
2005 Aug 19
13
Enumerations (again): Comments please
...BoilerPlate::Enumerations::EnumRecord def self.all return @@all if @@all @@all = find(:all, :order => ''#{order}'', :conditions => #{spec[:conditions].inspect}) end end END eval(class_def, TOPLEVEL_BINDING) enum_class = const_get(spec[:class_name]) enum_class.table_name = spec[:table_name] if spec[:table_name] enum_class end end end class Module # :nodoc: alias_method :const_missing_without_enums, :const_missing def const_missing(const_id) const_missing_without_enums(const_id) rescue...