Customizing factory-bot's scaffolding generator
When generating a new agenda like
rails g scaffold HighScore game:string score:integer the factory_bot generators create file
... invoke factory_bot create spec/factories/high_scores.rb ...
I Want to customize, that generator, so I write my own one. But I don't know where to save my new template, so the scaffold generator can use it.
Or my own generator:
lib/generators/rails/factory_bot_changes lib/generators/rails/factory_bot_changes/USAGE lib/generators/rails/factory_bot_changes/factory_bot_changes_generator.rb lib/generators/rails/factory_bot_changes/templates lib/generators/rails/factory_bot_changes/templates/factory_bot.rb
I also tried to change the
config.generators do |gen| gen.orm :active_record gen.template_engine :haml gen.test_framework :rspec, fixtures: true, view_specs: true, helper_specs: true, routing_specs: true, controller_specs: true, request_specs: true gen.helper :helper_and_policy gen.scaffold_controller :controller_with_smart_listing gen.fixture_replacement :factory_bot, dir: "spec/factories" # gen.fixture_replacement :factory_bot_changes, dir: "spec/factories" gen.factory_bot false end
But nothing seems to be working.
Where should I save the new template, or how can I trigger my own generator after scaffolding is done, to replace the file?