module Eaco::Adapters::ActiveRecord::Compatibility::V40
Rails v4.0.X compatibility layer for jsonb
Public Class Methods
included(base)
click to toggle source
Sets up the OID Type Map, reloads it, hacks native database types, and makes jsonb mimick itself as a json - for the rest of the AR machinery to work intact.
@param base [Class] the ActiveRecord
model to mangle @return [void]
# File lib/eaco/adapters/active_record/compatibility/v40.rb, line 19 def self.included(base) adapter = base.connection adapter.class::OID.register_type 'jsonb', adapter.class::OID::Json.new adapter.send :reload_type_map adapter.native_database_types.update(jsonb: {name: 'jsonb'}) adapter.class.parent::PostgreSQLColumn.instance_eval do include Column end base.extend Scoped end