lib/has/magic/columns.rb
# Load the MagicAttribute(s) associated with attr_name and cast them to proper type.
Load the MagicAttribute(s) associated with attr_name and cast them to proper type.
Load the MagicAttribute ( s ) associated with attr_name and cast them to proper type .
def read_attribute_with_magic(attr_name)
          return read_attribute_without_magic(attr_name) if column_for_attribute(attr_name) 
          attr_name = attr_name.to_s
          if !(value = @attributes[attr_name]).nil?
            if column = find_magic_column_by_name(attr_name)
              if value.is_a? Array
                value.map {|v| column.type_cast(v)}
              else
                column.type_cast(value)
              end
            else
              value
            end
          else
            nil
          end
        end
def read_attribute_with_magic ( attr_name ) return read_attribute_without_magic ( attr_name ) if column_for_attribute ( attr_name ) attr_name = attr_name . to_s if ! ( value = @attributes [ attr_name ] ) . nil? if column = find_magic_column_by_name ( attr_name ) if value . is_a? Array value . map { | v | column . type_cast ( v ) } else column . type_cast ( value ) end else value end else nil end end
Load the MagicAttribute(s) associated with attr_name and cast them to proper type.
Load the MagicAttribute ( s ) associated with attr_name and cast them to proper type .
# filter for regular columns
attr_name