Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/activerecord-postgres-hstore/activerecord.rb

Instance Method Summary collapse

Instance Method Details

#old_simplified_typeObject



122
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 122

alias :old_simplified_type :simplified_type

#old_type_cast_codeObject



121
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 121

alias :old_type_cast_code :type_cast_code

#simplified_type(field_type) ⇒ Object

Adds the hstore type for the column.



130
131
132
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 130

def simplified_type(field_type)
  field_type =~ /^hstore$/ ? :hstore : old_simplified_type(field_type)
end

#type_cast_code(var_name) ⇒ Object

Does the type casting from hstore columns using String#from_hstore or Hash#from_hstore.



125
126
127
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 125

def type_cast_code(var_name)
  type == :hstore ? "#{var_name}.from_hstore" : old_type_cast_code(var_name)
end