lib/eav_hashes/eav_entry.rb
# Converts the value from it's database representation to the type specified in the value_type column.
Converts the value from it's database representation to the type specified in the value_type column.
Converts the value from it ' s database representation to the type specified in the value_type column .
def deserialize_value
        if @value.nil?
          @value = read_attribute :value
        end
        case value_type
          when SUPPORTED_TYPES[:Object] 
            @value = YAML::load @value
          when SUPPORTED_TYPES[:Symbol]
            @value = @value.to_sym
          when SUPPORTED_TYPES[:Integer] 
            @value = @value.to_i
          when SUPPORTED_TYPES[:Float]
            @value = @value.to_f
          when SUPPORTED_TYPES[:Complex]
            @value = Complex @value
          when SUPPORTED_TYPES[:Rational]
            @value = Rational @value
          when SUPPORTED_TYPES[:Boolean]
            @value = (@value == "true")
          else
            @value
        end
      end
def deserialize_value if @value . nil? @value = read_attribute :value end case value_type when SUPPORTED_TYPES [ :Object ] @value = YAML :: load @value when SUPPORTED_TYPES [ :Symbol ] @value = @value . to_sym when SUPPORTED_TYPES [ :Integer ] @value = @value . to_i when SUPPORTED_TYPES [ :Float ] @value = @value . to_f when SUPPORTED_TYPES [ :Complex ] @value = Complex @value when SUPPORTED_TYPES [ :Rational ] @value = Rational @value when SUPPORTED_TYPES [ :Boolean ] @value = ( @value == "true" ) else @value end end
Converts the value from it's database representation to the type specified in the value_type column.
Converts the value from it ' s database representation to the type specified in the value_type column .
# or Hash, Array, etc. # or Fixnum, Bignum