Module: Eaco::Adapters::ActiveRecord::Compatibility::V40::Column
- Defined in:
- lib/eaco/adapters/active_record/compatibility/v40.rb
Overview
Patches to ActiveRecord::ConnectionAdapters::PostgreSQLColumn
Instance Method Summary collapse
-
#simplified_type(field_type) ⇒ Symbol
Makes
simplified_typereturnjsonforjsonbcolumns. -
#sql_type ⇒ String
Makes
sql_typereturnjsonforjsonbcolumns.
Instance Method Details
#simplified_type(field_type) ⇒ Symbol
Makes simplified_type return json for jsonb columns
54 55 56 57 58 59 60 |
# File 'lib/eaco/adapters/active_record/compatibility/v40.rb', line 54 def simplified_type(field_type) if field_type == 'jsonb' :json else super end end |
#sql_type ⇒ String
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.
43 44 45 46 |
# File 'lib/eaco/adapters/active_record/compatibility/v40.rb', line 43 def sql_type orig_type = super orig_type == 'jsonb' ? 'json' : orig_type end |