Created
January 30, 2012 21:46
-
-
Save therabidbanana/1706920 to your computer and use it in GitHub Desktop.
Fix broken mongo railtie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/assets.rake | |
# | |
# adapted from: http://blog.noizeramp.com/2011/10/14/rails-3-asset-pipeline-on-heroku-when-using-mongoid/ | |
# | |
pt = Rake::Task['assets:environment'] | |
Rake.application.send(:eval, "@tasks.delete('assets:environment')") | |
namespace :assets do | |
task :environment do | |
module ::MongoMapper::Connection | |
def setup(*args) | |
puts "Skipping connection to Mongo DB" | |
end | |
def connect(env) | |
puts "Skipping connection to Mongo DB" | |
end | |
end | |
pt.execute | |
end | |
end |
Good point - do you know off-hand which order it executes them in though? Obviously this hack has to go before the other environment. I just copy-pasted it from that other blog post, didn't really look into how it worked. :)
Should be in the order that they're defined, which I guess probably matters in this case.
…On Monday, January 30, 2012 at 7:29 PM, David Haslem wrote:
Good point - do you know off-hand which order it executes them in though? Obviously this hack has to go before the other environment. I just copy-pasted it from that other blog post, didn't really look into how it worked. :)
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1706920
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You shouldn't need to store off the original task and delete it. When you define a task that has already been defined, Rake doesn't override it, but adds to it.