跳至内容 跳至搜索
方法
A
C
D
S
T
包含的模块

实例公共方法

accessor()

# File activerecord/lib/active_record/type/json.rb, line 25
def accessor
  ActiveRecord::Store::StringKeyedHashAccessor
end

changed_in_place?(raw_old_value, new_value)

# 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

deserialize(value)

# 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

serialize(value)

# File activerecord/lib/active_record/type/json.rb, line 17
def serialize(value)
  ActiveSupport::JSON.encode(value) unless value.nil?
end

type()

# File activerecord/lib/active_record/type/json.rb, line 8
def type
  :json
end