Module: TrickSerial::Serializer::Rails::V3::ActiveRecordSessionSerializer

Defined in:
lib/trick_serial/serializer/rails.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(target) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/trick_serial/serializer/rails.rb', line 58

def self.included target
  super
  target.class_eval do
    alias :marshal_data_without_trick_serial_serializer! :marshal_data!
    alias :marshal_data! :marshal_data_with_trick_serial_serializer!
  end
end

Instance Method Details

#marshal_data_with_trick_serial_serializer!Object



66
67
68
69
70
71
72
73
74
75
# File 'lib/trick_serial/serializer/rails.rb', line 66

def marshal_data_with_trick_serial_serializer!
  save_data = @data
  if loaded?
    serializer = TrickSerial::Serializer.default.dup
    @data = serializer.encode(@data)
  end
  marshal_data_without_trick_serial_serializer!
ensure
  @data = save_data
end