Module My_Gem Class InstallGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __File__) def add_my_gem_routes route "match '/my_gem', :to => 'my gem actions#some method in my controller'" end def add_initializer template "my_gem.rb", "config/initializers/my_gem.rb" end def add_controller template "my_gem_actions_controller.rb", "app/controllers/my_gem_actions_controller.rb end end end