Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Drop support for Mongoid 2

  • Loading branch information...
commit 99163f51f63c6f2c2476734e90ea253422dbe51a 1 parent 999aeb0
@brianhempel authored
View
6 lib/mongo_session_store-rails3.rb
@@ -18,11 +18,7 @@ def self.collection_name=(name)
if defined?(MongoidStore::Session)
- if Mongoid::VERSION.to_i > 2
- MongoidStore::Session.store_in :collection => MongoSessionStore.collection_name
- else
- MongoidStore::Session.store_in(name)
- end
+ MongoidStore::Session.store_in :collection => MongoSessionStore.collection_name
end
@collection_name
View
20 lib/mongo_session_store/mongoid_store.rb
@@ -10,30 +10,18 @@ class Session
include Mongoid::Document
include Mongoid::Timestamps
- if Mongoid::VERSION.to_i > 2
- store_in :collection => MongoSessionStore.collection_name
+ store_in :collection => MongoSessionStore.collection_name
- field :_id, :type => String
+ field :_id, :type => String
- field :data, :type => Moped::BSON::Binary, :default => Moped::BSON::Binary.new(:generic, Marshal.dump({}))
- else
- self.collection_name = MongoSessionStore.collection_name
-
- identity :type => String
-
- field :data, :type => BSON::Binary, :default => BSON::Binary.new(Marshal.dump({}))
- end
+ field :data, :type => Moped::BSON::Binary, :default => Moped::BSON::Binary.new(:generic, Marshal.dump({}))
attr_accessible :_id, :data
end
private
def pack(data)
- if Mongoid::VERSION.to_i > 2
- Moped::BSON::Binary.new(:generic, Marshal.dump(data))
- else
- BSON::Binary.new(Marshal.dump(data))
- end
+ Moped::BSON::Binary.new(:generic, Marshal.dump(data))
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.