Skip to Content Skip to Search

class ActiveRecord::Type::Json

Inherits From

Public instance methods

Source code GitHub
# File activerecord/lib/active_record/type/json.rb, line 25
def accessor
  ActiveRecord::Store::StringKeyedHashAccessor
end
Source code GitHub
# File activerecord/lib/active_record/type/json.rb, line 21
def changed_in_place?(raw_old_value, new_value)
  deserialize(raw_old_value) != new_value
end
Source code GitHub
# File activerecord/lib/active_record/type/json.rb, line 12
def deserialize(value)
  return value unless value.is_a?(::String)
  ActiveSupport::JSON.decode(value) rescue nil
end
Source code GitHub
# File activerecord/lib/active_record/type/json.rb, line 17
def serialize(value)
  ActiveSupport::JSON.encode(value) unless value.nil?
end
Source code GitHub
# File activerecord/lib/active_record/type/json.rb, line 8
def type
  :json
end

Definition files