Sha256: a12fac4b038f65a926fafd852a1daab80ba4447087419104dc4a9e37c59d8e70
Contents?: true
Size: 794 Bytes
Versions: 5
Compression:
Stored size: 794 Bytes
Contents
class Customize::Character < ActiveRecord::Base attr_accessor :content self.table_name = "customize_characters" serialize :value belongs_to :related, :polymorphic => true before_validation do |object| unless object.content.nil? case when object.content =~ /\d+/ object.value = content.to_i object.value_type = :integer when content =~ /(true)|(false)/ object.value = Boolean.new content object.value_type = :boolean when content =~ /[0-9\.]+/ object.value = Decimal.new content object.value_type = :decimal when content =~ /^\[/ object.value = "" object.value_type = :list when content =~ /^\{/ object.value = "" object.value_type = :hash else object.value = content object.value_type = :string end end end end
Version data entries
5 entries across 5 versions & 1 rubygems