Sha256: d8ea9e0fcf4b6965000edb756f70825af5a8542832c6397e8b583801f84e8a86

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

begin
  require 'warden'
rescue
  gem 'warden'
  require 'warden'
end

# Session Serialization in. This block determines how the user will be stored
# in the session. If you're using a complex object like an ActiveRecord model,
# it is not a good idea to store the complete object. An ID is sufficient.
Warden::Manager.serialize_into_session{ |user| [user.class, user.id] }

# Session Serialization out. This block gets the user out of the session.
# It should be the reverse of serializing the object into the session
Warden::Manager.serialize_from_session do |klass, id|
  begin
    klass.find(id)
  rescue ActiveRecord::RecordNotFound
    throw(:warden)
  end
end

# Setup devise strategies for Warden
require 'devise/strategies/base'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ramon-devise-0.4.2 lib/devise/warden.rb