class ActiveRecord::Coders::JsonHashColumn
Attributes
require_update[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/active_record/coders/json_hash_column.rb, line 7 def initialize(options = {}) @require_update = options.delete(:require_update){ false } end
Public Instance Methods
dump(hash)
click to toggle source
# File lib/active_record/coders/json_hash_column.rb, line 11 def dump(hash) ::JSON.dump(hash || {}) end
load(hash)
click to toggle source
# File lib/active_record/coders/json_hash_column.rb, line 15 def load(hash) ::HashWithIndifferentAccess.new ::JSON.load(hash || "{}") end