Sha256: 090416d228b1a62b8c279dca31cc7ed36867d13eea816ed5042965597219c1b6

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

require 'devise/strategies/base'

module Devise
  module Serializers
    module Base
      include Devise::Strategies::Base
      attr_reader :scope

      def serialize(record)
        record.class.send(:"serialize_into_#{serialization_type}", record)
      end

      def deserialize(keys)
        mapping.to.send(:"serialize_from_#{serialization_type}", keys)
      end

      def fetch(scope)
        @scope = scope
        super
      end

      def serialization_type
        @serialization_type ||= begin
          warden = self.class.ancestors.find{ |k| k < Warden::Serializers::Base && k != self.class }
          warden.name.split("::").last.underscore
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise-0.7.3 lib/devise/serializers/base.rb
devise-0.7.2 lib/devise/serializers/base.rb
devise-0.7.1 lib/devise/serializers/base.rb
devise-0.7.0 lib/devise/serializers/base.rb