Last Updated: February 25, 2016
·
631
· listrophy

Asset Precompilation + Mongoid

If you're deploying a mongoid application to heroku, and you'd like to use asset precompilation, you may run into precompilation problems. Stick a file in lib/tasks named mongoid_precompilation_patch.rake and put the following in it:

namespace :assets do
  task :silence_mongoid do
    module ::Mongoid
      def load!(config_file)
        puts "Skipping connection to Mongo DB"
      end
    end
  end

  task :environment => :silence_mongoid
end