Methods

Class Index [+]

Quicksearch

Sequel::Plugins::SerializationModificationDetection

This plugin extends the serialization plugin and enables it to detect changes in serialized values by checking whether the current deserialized value is the same as the original deserialized value. The serialization plugin does not do such checks by default, as they often aren’t needed and can hurt performance.

Note that for this plugin to work correctly, the values you are serializing must roundtrip correctly (i.e. deserialize(serialize(value)) should equal value). This is true in most cases, but not in all. For example, ruby symbols round trip through yaml, but not json (as they get turned into strings in json).

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 28
28:       def self.apply(model)
29:         model.plugin :serialization
30:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.