Rails application templates sound great, and I want to create my own custom template instead of repeating myself to create a common base for every single application I create.
How do I run the equivalent of rails new --api --webpack=react --database=postgresql from inside my template so that it automatically does this when I run rails new myapp -m http://example.com/template.rb
You don't. Application template is applied after rails app is already generated.
What you can do is overwrite some files/lines in your application template (replace database.yml, etc.). Or just add those flags in the rails new command, along with your template parameter.
If you want to always create apps with those flags, just put them in the .railsrc file and they'll be picked up automatically.
--api
--webpack=react
--database=postgresql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With