#:enddoc: module RailsConnector class Attribute < CmsBaseModel def self.type_of(name) attribute = attribute_cache[name.to_s] attribute.type if attribute end def self.reset_cache @attribute_cache = nil end def name attribute_name end def type attribute_type.to_sym end module ClassMethods private def attribute_cache @attribute_cache ||= find(:all).each_with_object({}) do |attr, map| map[attr.name] = attr end end end extend ClassMethods end end