rails / tailwindcss-rails

Other
1.39k stars 170 forks source link

Allow users to override scaffold generator templates #314

Closed flavorjones closed 8 months ago

flavorjones commented 8 months ago

Originally reported at #164

I think this PR is preferable to #247 because it has tests and is a simpler fix.

Note that in order to test this, the test suite now uses the same temporary directory for all tests, so we are then able to set Rails::Generators.templates_path before the generator classes are instantiated.

cc @dixpac

dixpac commented 8 months ago

Works great with scaffolds. However, it doesn't work with controllers(bin/rails g controller Home index) or mailers(bin/rails g mailer User notify). I'm not certain how frequently people would need to override those, but in those cases, it is not working.

flavorjones commented 8 months ago

@dixpac Yeah, I was hoping nobody would care about overriding those. :laughing: :sob:

You're right, while I'm here I might as well add mailer and controller. Thanks for the review!