Skip to content

Instantly share code, notes, and snippets.

@jc00ke
Forked from mulder/assets.rake
Created September 25, 2011 18:26
Show Gist options
  • Select an option

  • Save jc00ke/1240930 to your computer and use it in GitHub Desktop.

Select an option

Save jc00ke/1240930 to your computer and use it in GitHub Desktop.
Monkey Patch for assets:precomple for deploying on Heroku with Mongoid
namespace :assets do
# Prepend the assets:precompile_prepare task to assets:precompile.
task :precompile => :precompile_prepare
# This task will be called before assets:precompile to optimize the
# compilation, i.e. to prevent any DB calls.
task 'precompile_prepare' do
# Without this assets:precompile will call itself again with this var set.
# This basically speeds things up.
ENV['RAILS_GROUPS'] = 'assets'
# Devise uses this flag to prevent connecting to the db.
ENV['RAILS_ASSETS_PRECOMPILE'] = 'true'
# Prevent mongoid from loading
def Mongoid.load!(*args)
true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment