Skip to content

Instantly share code, notes, and snippets.

@loopj
Created October 10, 2014 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loopj/742f077b47eb2e9fe55b to your computer and use it in GitHub Desktop.
Save loopj/742f077b47eb2e9fe55b to your computer and use it in GitHub Desktop.
Load rake tasks from gems in rails 2.3
# 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