diff options
Diffstat (limited to 'vendor/gems/couchrest_session_store/lib/couchrest/session/document.rb')
-rw-r--r-- | vendor/gems/couchrest_session_store/lib/couchrest/session/document.rb | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/vendor/gems/couchrest_session_store/lib/couchrest/session/document.rb b/vendor/gems/couchrest_session_store/lib/couchrest/session/document.rb deleted file mode 100644 index dc938cf..0000000 --- a/vendor/gems/couchrest_session_store/lib/couchrest/session/document.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'time' - -class CouchRest::Session::Document < CouchRest::Document - include CouchRest::Model::Configuration - include CouchRest::Model::Connection - include CouchRest::Model::Rotation - - rotate_database 'sessions', - :every => 1.month, :expiration_field => :expires - - def self.fetch(id) - database.get(id) - end - - def self.find_by_expires(options = {}) - options[:reduce] ||= false - design = database.get '_design/Session' - response = design.view :by_expires, options - response['rows'] - end - - def self.create_database!(name=nil) - db = super(name) - begin - db.get('_design/Session') - rescue CouchRest::NotFound - design = File.read(File.expand_path('../../../../design/Session.json', __FILE__)) - design = JSON.parse(design) - db.save_doc(design.merge({"_id" => "_design/Session"})) - end - db - end - -end |