I'm having quite a bit of trouble getting mongo and rails 4 to play nicely, currently my gemfile looks like
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
gem "zeus", "~> 0.13.3"
gem "thin", "~> 1.6.0"
gem "pry", "~> 0.9.12.2"
gem "rspec-rails", "~> 2.14.0"
gem "font-awesome-rails"
gem "haml", "~> 4.0.3"
gem "skrollr-rails", "~> 0.6.12"
gem "zurb-foundation", "~> 4.3.2"
gem 'rails_12factor', group: :production
gem "bourbon", "~> 3.1.8"
gem "gon", "~> 4.1.1"
gem "d3-rails"
gem 'underscore-rails'
gem 'mongoid', github: 'mongoid/mongoid'
group :doc do
gem 'sdoc', require: false
end
my mongoid.yml looks like
development:
sessions:
default:
database: mongoid
hosts:
- localhost:27017
options:
options:
production:
sessions:
default:
url: <%= ENV['MONGOHQ_URL'] %>
options:
consistency: :strong
max_retries: 1
retry_interval: 0
and I'm getting the below error,
[jd@mbp ~/Dropbox/honeybadgerconsulting/appcellerator/maturity_assessment (master *)]$ rails s
/Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- rack/mongoid (LoadError)
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/bundler/gems/mongoid-9296c9372579/lib/mongoid.rb:33:in `<top (required)>'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/jd/Dropbox/honeybadgerconsulting/appcellerator/maturity_assessment/config/application.rb:10:in `<top (required)>'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Users/jd/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
when I try to run a rails server.
i've got one model defined, just to test that mongo is working correctly
class Project
include Mongoid::Document
field :name, type: String
field :status, type: String
end
and my application.rb has the below additions that i saw on the seemingly incomplete tutorial-sphere of the internet.
require File.expand_path('../boot', __FILE__)
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
any help as to what direction to take this would be much appreciated.
Problem solved. Was a bug https://github.com/mongoid/mongoid/pull/3368, now wokrs fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With