Module: ArJdbc::SQLite3::Column

Included in:
ActiveRecord::ConnectionAdapters::SQLite3Column
Defined in:
lib/arjdbc/sqlite3/adapter.rb

Instance Method Summary collapse

Instance Method Details

#init_column(name, default, *args) ⇒ Object



18
19
20
# File 'lib/arjdbc/sqlite3/adapter.rb', line 18

def init_column(name, default, *args)
  @default = nil if default =~ /NULL/
end

#type_cast(value) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/arjdbc/sqlite3/adapter.rb', line 22

def type_cast(value)
  return nil if value.nil?
  case type
  when :string   then value
  when :primary_key then defined?(value.to_i) ? value.to_i : (value ? 1 : 0)
  when :float    then value.to_f
  when :decimal  then self.class.value_to_decimal(value)
  when :boolean  then self.class.value_to_boolean(value)
  else super
  end
end