I want to run the generator from gem whenever the model generator is called.
Following
require 'rails' module Mygenerator class Railtie < Rails::Railtie config.app_generators.orm :my_generator end end
correctly calls my generator, but the native Rails generator no longer starts.
I guess I could run my own generator through invoke , but that seems too complicated. What about all the other ORM generators?
Is there a better way to βattachβ my generator to an existing one?
Update:
This naturally works, but I still hope for something cleaner:
module Rails module Generators class ModelGenerator < NamedBase def run_my_custom_generator invoke "my_generator:foo" end end end end
polarblau
source share