Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Inherits:
Column
  • Object
show all
Defined in:
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Overview

PostgreSQL-specific extensions to column definitions in a table.

Constant Summary

Constants inherited from Column

Column::FALSE_VALUES, Column::TRUE_VALUES

Class Attribute Summary collapse

Attributes inherited from Column

#coder, #default, #limit, #name, #null, #precision, #primary, #scale, #sql_type, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Column

binary_to_string, #extract_default, #has_default?, #human_name, #klass, #number?, string_to_binary, #string_to_binary, string_to_date, string_to_dummy_time, #text?, #type_cast, #type_cast_code, value_to_boolean, value_to_decimal

Constructor Details

#initialize(name, default, sql_type = nil, null = true) ⇒ PostgreSQLColumn

Instantiates a new PostgreSQL column definition in a table.



36
37
38
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 36

def initialize(name, default, sql_type = nil, null = true)
  super(name, self.class.extract_value_from_default(default), sql_type, null)
end

Class Attribute Details

.money_precisionObject

Returns the value of attribute money_precision



42
43
44
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 42

def money_precision
  @money_precision
end

Class Method Details

.string_to_time(string) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 43

def string_to_time(string)
  return string unless String === string

  case string
  when 'infinity'  then 1.0 / 0.0
  when '-infinity' then -1.0 / 0.0
  else
    super
  end
end