Sha256: ad980bea6a4615898baeac534dcfb7172a16e8a2f86707493041f363301a6e99
Contents?: true
Size: 763 Bytes
Versions: 67
Compression:
Stored size: 763 Bytes
Contents
module Appstats class Context < ActiveRecord::Base set_table_name "appstats_contexts" belongs_to :entry, :foreign_key => "appstats_entry_id" attr_accessible :context_key, :context_value def context_value=(value) self[:context_value] = value self[:context_int] = nil self[:context_float] = nil return if value.nil? as_int = value.to_i as_float = value.to_f self[:context_int] = as_int if as_int.to_s == value self[:context_float] = as_float if as_float.to_s == value || !self[:context_int].nil? end def to_s return "No Context" if context_key.nil? || context_key == '' "#{context_key}[]" if context_value.nil? "#{context_key}[#{context_value}]" end end end
Version data entries
67 entries across 67 versions & 1 rubygems