To auto-invoke on rake:db:migrate in Rails 3 using as gem #23

Closed
aceofspades opened this Issue May 16, 2011 · 3 comments

Comments

Projects
None yet
4 participants

Add to the end of your Rakefile.

Dir["#{Gem.searcher.find('annotate').full_gem_path}/**/tasks/**/*.rake"].each {|ext| load ext}
Owner

ctran commented Jun 27, 2011

Added this to the wiki.

ctran closed this Jun 27, 2011

To avoid deprecation warnings use:

Dir["#{Gem::Specification.find_by_name("annotate").full_gem_path}/**/tasks/**/*.rake"].each {|ext| load ext}

eLafo commented Nov 26, 2012

I think this should be done only in development mode. So maybe it is better to use:

Dir["#{Gem::Specification.find_by_name("annotate").full_gem_path}/**/tasks/**/*.rake"].each {|ext| load ext} if Rails.env.development?

ctran added the reviewed label Dec 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment