I have written a gem with an install generator. I would like to use this generator to add routes to the config/routes.rb file, much in the same way as the devise gem does by adding devise_for :model_name. Therefore, I need to know how to:
Make a method (like devise_for) available within the scope of routes?
Ok I’ve figured it out. To add to the routes file you can use the method
routein the generator. I have accomplished this by adding the following to my install_generator.rb file:Note that I am in fact calling a method, which can be added to the scope of routes by defining it in the following namespace: