Module: ATDIS::TypeCastAttributes::ClassMethods
- Defined in:
- lib/atdis/model.rb
Instance Method Summary collapse
-
#set_field_mappings(p) ⇒ Object
of the form Fixnum, address: String.
Instance Method Details
#set_field_mappings(p) ⇒ Object
of the form Fixnum, address: String
14 15 16 17 18 19 20 21 22 |
# File 'lib/atdis/model.rb', line 14 def set_field_mappings(p) define_attribute_methods(p.keys.map{|k| k.to_s}) # Convert all values to arrays. Doing this for the sake of tidier notation self.attribute_types = {} p.each do |k,v| v = [v] unless v.kind_of?(Array) self.attribute_types[k] = v end end |