Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn
- Inherits:
-
Column
- Object
- Column
- ActiveRecord::ConnectionAdapters::PostgreSQLColumn
- Defined in:
- lib/activerecord-postgres-json/activerecord.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#simplified_type_with_json(field_type) ⇒ Object
Adds the json type for the column.
Class Method Details
.extract_value_from_default_with_json(default) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/activerecord-postgres-json/activerecord.rb', line 40 def extract_value_from_default_with_json(default) case default when "'{}'::json", "'{}'::jsonb" '{}' when "'[]'::json", "'[]'::jsonb" '[]' else extract_value_from_default_without_json(default) end end |
Instance Method Details
#simplified_type_with_json(field_type) ⇒ Object
Adds the json type for the column.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/activerecord-postgres-json/activerecord.rb', line 26 def simplified_type_with_json(field_type) case field_type when 'json' :json when 'jsonb' :jsonb else simplified_type_without_json(field_type) end end |