From 7267f4aa4385c2ae7f51ee91381d66d6def780dd Mon Sep 17 00:00:00 2001 From: Fabrice Lejeune Date: Mon, 11 Jun 2012 10:31:01 +0200 Subject: [PATCH 1/2] updating to mongoid 3.0.0.rc --- Gemfile | 10 +-- Gemfile.lock | 40 ++++++----- lib/mongoid_session_store/mongoid_store.rb | 7 +- mongoid_session_store.gemspec | 2 +- test/dummy/config/mongoid.yml | 78 ++++++++++++++++------ 5 files changed, 91 insertions(+), 46 deletions(-) diff --git a/Gemfile b/Gemfile index 3f3689d..a1d70bb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ -source "http://rubygems.org" +source 'http://rubygems.org' gem 'rails', '3.1.0' -gem "rake", "~> 0.9.2.2" +gem 'rake', '~> 0.9.2.2' # gem 'rails', :git => 'git://github.com/rails/rails.git' -gem "mongoid", "~> 2.3.3" -gem "bson_ext", "~> 1.4" +gem 'mongoid', '~> 3.0.0.rc' +gem 'bson_ext', '~> 1.6' if RUBY_VERSION < '1.9' - gem "ruby-debug", ">= 0.10.3" + gem 'ruby-debug', '>= 0.10.3' end diff --git a/Gemfile.lock b/Gemfile.lock index 489ee8a..4b5362c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,28 +30,31 @@ GEM activesupport (= 3.1.0) activesupport (3.1.0) multi_json (~> 1.0) - arel (2.2.1) - bcrypt-ruby (3.0.0) - bson (1.4.0) - bson_ext (1.4.0) + arel (2.2.3) + bcrypt-ruby (3.0.1) + bson (1.6.4) + bson_ext (1.6.4) + bson (~> 1.6.4) builder (3.0.0) erubis (2.7.0) hike (1.2.1) i18n (0.6.0) - mail (2.3.0) + json (1.7.3) + mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.16) - mongo (1.4.0) - bson (= 1.4.0) - mongoid (2.3.3) + mime-types (1.18) + mongoid (3.0.0.rc) activemodel (~> 3.1) - mongo (~> 1.3) + moped (~> 1.0.0.rc) + origin (~> 1.0.0.rc) tzinfo (~> 0.3.22) - multi_json (1.0.3) - polyglot (0.3.2) - rack (1.3.2) + moped (1.0.0.rc) + multi_json (1.3.6) + origin (1.0.0) + polyglot (0.3.3) + rack (1.3.6) rack-cache (1.0.3) rack (>= 0.4) rack-mount (0.8.3) @@ -76,8 +79,9 @@ GEM rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) - rdoc (3.9.4) - sprockets (2.0.0) + rdoc (3.12) + json (~> 1.4) + sprockets (2.0.4) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) @@ -86,13 +90,13 @@ GEM treetop (1.4.10) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.29) + tzinfo (0.3.33) PLATFORMS ruby DEPENDENCIES - bson_ext (~> 1.4) - mongoid (~> 2.3.3) + bson_ext (~> 1.6) + mongoid (~> 3.0.0.rc) rails (= 3.1.0) rake (~> 0.9.2.2) diff --git a/lib/mongoid_session_store/mongoid_store.rb b/lib/mongoid_session_store/mongoid_store.rb index ded02f5..e47594d 100644 --- a/lib/mongoid_session_store/mongoid_store.rb +++ b/lib/mongoid_session_store/mongoid_store.rb @@ -5,11 +5,12 @@ class MongoidStore < AbstractStore class Session include Mongoid::Document - store_in :sessions + store_in collection: 'sessions' - identity :type => String + field :id, type: String + attr_accessible :id - field :data, :type => String, :default => [Marshal.dump({})].pack("m*") + field :data, type: String, default: [Marshal.dump({})].pack("m*") end # The class used for session storage. diff --git a/mongoid_session_store.gemspec b/mongoid_session_store.gemspec index f13e4b0..bdb2667 100644 --- a/mongoid_session_store.gemspec +++ b/mongoid_session_store.gemspec @@ -9,5 +9,5 @@ Gem::Specification.new do |s| s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] s.add_dependency('rails', "~> 3.0") - s.add_dependency('mongoid', '~> 2.3') + s.add_dependency('mongoid', '~> 3.0.0.rc') end diff --git a/test/dummy/config/mongoid.yml b/test/dummy/config/mongoid.yml index 3bd30c6..3dde0df 100644 --- a/test/dummy/config/mongoid.yml +++ b/test/dummy/config/mongoid.yml @@ -1,20 +1,60 @@ -development: - host: localhost - database: dummy_development - test: - host: localhost - database: dummy_test - -# set these environment variables on your prod server -production: - host: <%= ENV['MONGOID_HOST'] %> - port: <%= ENV['MONGOID_PORT'] %> - username: <%= ENV['MONGOID_USERNAME'] %> - password: <%= ENV['MONGOID_PASSWORD'] %> - database: <%= ENV['MONGOID_DATABASE'] %> - # slaves: - # - host: slave1.local - # port: 27018 - # - host: slave2.local - # port: 27019 + # Configure available database sessions. (required) + sessions: + # Defines the default session. (required) + default: + # Defines the name of the default database that Mongoid can connect to. + # (required). + database: dummy_test + # Provides the hosts the default session can connect to. Must be an array + # of host:port pairs. (required) + hosts: + - localhost:27017 + options: + # Change whether the session persists in safe mode by default. + # (default: false) + # safe: false + + # Change the default consistency model to :eventual or :strong. + # :eventual will send reads to secondaries, :strong sends everything + # to master. (default: :eventual) + consistency: :strong + # Configure Mongoid specific options. (optional) + options: + # Configuration for whether or not to allow access to fields that do + # not have a field definition on the model. (default: true) + # allow_dynamic_fields: true + + # Enable the identity map, needed for eager loading. (default: false) + # identity_map_enabled: false + + # Includes the root model name in json serialization. (default: false) + # include_root_in_json: false + + # Include the _type field in serializaion. (default: false) + # include_type_for_serialization: false + + # Preload all models in development, needed when models use + # inheritance. (default: false) + # preload_models: false + + # Protect id and type from mass assignment. (default: true) + # protect_sensitive_fields: true + + # Raise an error when performing a #find and the document is not found. + # (default: true) + # raise_not_found_error: true + + # Raise an error when defining a scope with the same name as an + # existing method. (default: false) + # scope_overwrite_exception: false + + # Skip the database version check, used when connecting to a db without + # admin access. (default: false) + # skip_version_check: false + + # User Active Support's time zone in conversions. (default: true) + # use_activesupport_time_zone: true + + # Ensure all times are UTC in the app side. (default: false) + # use_utc: false From 5dfd03f590b1fb3480d98dba978ba3f672327998 Mon Sep 17 00:00:00 2001 From: Fabrice Lejeune Date: Fri, 22 Feb 2013 16:03:35 +0100 Subject: [PATCH 2/2] update mongoid version --- Gemfile | 2 +- Gemfile.lock | 40 +++++++++++++++++------------------ mongoid_session_store.gemspec | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Gemfile b/Gemfile index a1d70bb..a2c0571 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gem 'rails', '3.1.0' gem 'rake', '~> 0.9.2.2' # gem 'rails', :git => 'git://github.com/rails/rails.git' -gem 'mongoid', '~> 3.0.0.rc' +gem 'mongoid', '~> 3.0' gem 'bson_ext', '~> 1.6' if RUBY_VERSION < '1.9' diff --git a/Gemfile.lock b/Gemfile.lock index 4b5362c..78f96c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,36 +32,36 @@ GEM multi_json (~> 1.0) arel (2.2.3) bcrypt-ruby (3.0.1) - bson (1.6.4) - bson_ext (1.6.4) - bson (~> 1.6.4) - builder (3.0.0) + bson (1.8.2) + bson_ext (1.8.2) + bson (~> 1.8.2) + builder (3.0.4) erubis (2.7.0) hike (1.2.1) - i18n (0.6.0) - json (1.7.3) + i18n (0.6.1) + json (1.7.7) mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.18) - mongoid (3.0.0.rc) + mime-types (1.21) + mongoid (3.0.22) activemodel (~> 3.1) - moped (~> 1.0.0.rc) - origin (~> 1.0.0.rc) + moped (~> 1.2) + origin (~> 1.0) tzinfo (~> 0.3.22) - moped (1.0.0.rc) - multi_json (1.3.6) - origin (1.0.0) + moped (1.4.2) + multi_json (1.6.1) + origin (1.0.11) polyglot (0.3.3) - rack (1.3.6) + rack (1.3.10) rack-cache (1.0.3) rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) - rack-ssl (1.3.2) + rack-ssl (1.3.3) rack - rack-test (0.6.1) + rack-test (0.6.2) rack (>= 1.0) rails (3.1.0) actionmailer (= 3.1.0) @@ -79,7 +79,7 @@ GEM rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) - rdoc (3.12) + rdoc (3.12.1) json (~> 1.4) sprockets (2.0.4) hike (~> 1.2) @@ -87,16 +87,16 @@ GEM tilt (~> 1.1, != 1.3.0) thor (0.14.6) tilt (1.3.3) - treetop (1.4.10) + treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.33) + tzinfo (0.3.35) PLATFORMS ruby DEPENDENCIES bson_ext (~> 1.6) - mongoid (~> 3.0.0.rc) + mongoid (~> 3.0) rails (= 3.1.0) rake (~> 0.9.2.2) diff --git a/mongoid_session_store.gemspec b/mongoid_session_store.gemspec index bdb2667..d62136e 100644 --- a/mongoid_session_store.gemspec +++ b/mongoid_session_store.gemspec @@ -9,5 +9,5 @@ Gem::Specification.new do |s| s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] s.add_dependency('rails', "~> 3.0") - s.add_dependency('mongoid', '~> 3.0.0.rc') + s.add_dependency('mongoid', '~> 3.0') end