Methods

Class/Module Index [+]

Quicksearch

Sequel::Plugins::SerializationModificationDetection

Sequel's built in Serialization plugin doesn't check for modification of the serialized objects, because it requires an extra deserialization of a potentially very large object. This plugin can detect changes in serialized values by checking whether the current deserialized value is the same as the original deserialized value. This does require deserializing the value twice, but the original deserialized value is cached.

Example

require 'sequel'
require 'json'
class User < Sequel::Model
  plugin :serialization, :json, :permissions
  plugin :serialization_modification_detection
end
user = User.create(:permissions => {})
user.permissions[:global] = 'read-only'
user.save_changes

Public Class Methods

apply(model) click to toggle source

Load the serialization plugin automatically.

# File lib/sequel/plugins/serialization_modification_detection.rb, line 23
def self.apply(model)
  model.plugin :serialization
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.