I'm tweaking some scaffold templates for an app so I mostly just want to copy the built-in/default templates. My question is what is the process I can follow to locate the templates?
For example, thanks to the helpful answers of Tim Krins I now know to look in:
cd $(bundle show railties)/lib/rails/generators/rails/scaffold_controller/templates/
for controller templates (reference)cd $(bundle show activerecord)/lib/rails/generators/active_record/model/templates/
for model templates (reference)
I also managed to combine his bundle show <gem>
tip with spelunking through Github issues in haml-rails to figure out the path for HAML templates is:
cd $(bundle show haml-rails)/lib/generators/haml/scaffold/templates
I haven't yet been able to use that knowledge to figure out the general solution though so next time I'll have to search StackOverflow again.
How would I go about figuring out for myself the template locations for various test files (without telling you which testing framework I'm using)? How would I locate the templates used for the invoke resource_route
step?
- How do I figure out which gem to look in? (e.g. How could I have figured out railties vs activerecord above?)
- How do I figure out what path to look in? (e.g. How would I know to look in activerecord/.../activerecord but railties/.../rails?)