Created
October 10, 2014 18:23
-
-
Save loopj/742f077b47eb2e9fe55b to your computer and use it in GitHub Desktop.
Load rake tasks from gems in rails 2.3
This file contains 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
# Rails 2.3 doesn't automatically load rake tasks from required gems | |
# Add the following code to your app's Rakefile to fix that | |
gem_tasks = [] | |
Gem.loaded_specs.each do |name, spec| | |
next if %w{rake rails bundler activesupport rack actionpack actionmailer activerecord activeresource mysql2}.include?(name) | |
spec.load_paths.each do |load_path| | |
gem_tasks += | |
Dir.glob("#{load_path}/**/tasks/*.rake") | |
end | |
end | |
gem_tasks.map {|f| load f } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment