1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #45375 from philippneugebauer/main

add repo link for scaffold templates to docs [ci-skip]
This commit is contained in:
Jonathan Hefner 2022-06-17 12:50:51 -05:00 committed by GitHub
commit 54d866b000
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -338,7 +338,9 @@ config.generators do |g|
end end
``` ```
If you generate another resource, you can see that we get exactly the same result! This is useful if you want to customize your scaffold templates and/or layout by just creating `edit.html.erb`, `index.html.erb` and so on inside `lib/templates/erb/scaffold`. Now, if you generate another resource, you will see a similar result!
Another common use of custom templates is overriding the [default scaffold view templates](https://github.com/rails/rails/tree/main/railties/lib/rails/generators/erb/scaffold/templates). You can override any of these by creating the appropriate file (e.g. `index.html.erb`, `show.html.erb`, etc) in `lib/templates/erb/scaffold`.
Scaffold templates in Rails frequently use ERB tags; these tags need to be Scaffold templates in Rails frequently use ERB tags; these tags need to be
escaped so that the generated output is valid ERB code. escaped so that the generated output is valid ERB code.