class ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Public Class Methods

extract_value_from_default_with_json(default) click to toggle source
# File lib/activerecord-postgres-json/activerecord.rb, line 33
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

Public Instance Methods

simplified_type_with_json(field_type) click to toggle source

Adds the json type for the column.

# File lib/activerecord-postgres-json/activerecord.rb, line 19
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