Skip to content

Updating to Mongoid 3.0.0.rc #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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'
gem 'bson_ext', '~> 1.6'

if RUBY_VERSION < '1.9'
gem "ruby-debug", ">= 0.10.3"
gem 'ruby-debug', '>= 0.10.3'
end
50 changes: 27 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,38 @@ 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)
builder (3.0.0)
arel (2.2.3)
bcrypt-ruby (3.0.1)
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)
mail (2.3.0)
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.16)
mongo (1.4.0)
bson (= 1.4.0)
mongoid (2.3.3)
mime-types (1.21)
mongoid (3.0.22)
activemodel (~> 3.1)
mongo (~> 1.3)
moped (~> 1.2)
origin (~> 1.0)
tzinfo (~> 0.3.22)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.2)
moped (1.4.2)
multi_json (1.6.1)
origin (1.0.11)
polyglot (0.3.3)
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)
Expand All @@ -76,23 +79,24 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.9.4)
sprockets (2.0.0)
rdoc (3.12.1)
json (~> 1.4)
sprockets (2.0.4)
hike (~> 1.2)
rack (~> 1.0)
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.29)
tzinfo (0.3.35)

PLATFORMS
ruby

DEPENDENCIES
bson_ext (~> 1.4)
mongoid (~> 2.3.3)
bson_ext (~> 1.6)
mongoid (~> 3.0)
rails (= 3.1.0)
rake (~> 0.9.2.2)
7 changes: 4 additions & 3 deletions lib/mongoid_session_store/mongoid_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion mongoid_session_store.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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')
end
78 changes: 59 additions & 19 deletions test/dummy/config/mongoid.yml
Original file line number Diff line number Diff line change
@@ -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