module Eaco::Adapters::ActiveRecord::Compatibility::V40::Column

Patches to ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Public Instance Methods

simplified_type(field_type) click to toggle source

Makes simplified_type return json for jsonb columns

@param field_type [String] the database field type @return [Symbol] the simplified type

Calls superclass method
# File lib/eaco/adapters/active_record/compatibility/v40.rb, line 56
def simplified_type(field_type)
  if field_type == 'jsonb'
    :json
  else
    super
  end
end
sql_type() click to toggle source

Makes sql_type return json for jsonb columns. This is an hack to let the casting machinery in AR 4.0 keep working with the unsupported jsonb type.

@return [String] the SQL type.

Calls superclass method
# File lib/eaco/adapters/active_record/compatibility/v40.rb, line 45
def sql_type
  orig_type = super
  orig_type == 'jsonb' ? 'json' : orig_type
end