Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extract_value_from_default_with_json(default) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/activerecord-postgres-json/activerecord.rb', line 18

def extract_value_from_default_with_json(default)
  case default
  when "'{}'::json"
    '{}'
  when "'[]'::json"
    '[]'
  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.



11
12
13
# File 'lib/activerecord-postgres-json/activerecord.rb', line 11

def simplified_type_with_json(field_type)
  field_type == 'json' ? :json : simplified_type_without_json(field_type)
end