Mongoid and assets problem on Ruby on Rails 3.2

I was doing my first Ruby on Rails application with MongoDB (via Mongoid gem). When I deployed the application to a production server, assets were compiled correctly but all javascript and css links were still pointing to stylesheets and javascripts folders, like

<link href=”/stylesheets/application.css” media=”screen” rel=”stylesheet” type=”text/css” />

I checked capistrano and server configurations, but nothing were wrong there. Finally I figured out what was causing the problem. I have not required “sprockets/railtie” in the config/application.rb

In the Mongoid documentation especially in ‘Configuration’ section is ‘Getting Rid of Active Record’ subsection which says:

Open myapp/config/application.rb and near the top, remove the line require "rails/all" and add the following lines so you end up with this:

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
# require "sprockets/railtie" # Uncomment this line for Rails 3.1+

In a rush I only saw number 3.1 and thought it is okay to leave it as uncommented. Current Rails version is 3.2.8 so should that line be uncommented as default on Mongoid documentation?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s