Methods
Included Modules
Instance Public methods
accessor()
📝 Source code
# File activerecord/lib/active_record/type/json.rb, line 25
def accessor
ActiveRecord::Store::StringKeyedHashAccessor
end
🔎 See on GitHub
changed_in_place?(raw_old_value, new_value)
📝 Source code
# 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
🔎 See on GitHub
deserialize(value)
📝 Source code
# 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
🔎 See on GitHub
serialize(value)
📝 Source code
# File activerecord/lib/active_record/type/json.rb, line 17
def serialize(value)
ActiveSupport::JSON.encode(value) unless value.nil?
end
🔎 See on GitHub
type()
📝 Source code
# File activerecord/lib/active_record/type/json.rb, line 8
def type
:json
end
🔎 See on GitHub