Skip to content

Instantly share code, notes, and snippets.

@rodrigomaia
Created March 5, 2012 18:34
Show Gist options
  • Save rodrigomaia/1980204 to your computer and use it in GitHub Desktop.
Save rodrigomaia/1980204 to your computer and use it in GitHub Desktop.
Loading rake task and generators
Loading rake tasks and generators
If your railtie has rake tasks, you can tell Rails to load them through the method ::rake_tasks:
class MyRailtie < Rails::Railtie
rake_tasks do
load "path/to/my_railtie.tasks"
end
end
By default, Rails load generators from your load path. However, if you want to place your generators at a different location, you can specify in your Railtie a block which will load them during normal generators lookup:
class MyRailtie < Rails::Railtie
generators do
require "path/to/my_railtie_generator"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment