aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorAditya Kapoor <aditya.kapoor@vinsol.com>2014-08-14 02:33:35 +0530
committerAditya Kapoor <aditya.kapoor@vinsol.com>2014-08-14 02:33:35 +0530
commit32e184864f6b69f74b90112cd1755ea7a33e5656 (patch)
tree053ef4962d09b9aa37163967bb99cab3a1ce1af5 /guides/source
parentb89c5a043e81298527f369fdb5fc83eb1f290dfe (diff)
downloadrails-32e184864f6b69f74b90112cd1755ea7a33e5656.tar.gz
rails-32e184864f6b69f74b90112cd1755ea7a33e5656.tar.bz2
rails-32e184864f6b69f74b90112cd1755ea7a33e5656.zip
[ci skip] add note about the ERB escape in generator docs
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/generators.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/guides/source/generators.md b/guides/source/generators.md
index 5e88fa0c70..2349908979 100644
--- a/guides/source/generators.md
+++ b/guides/source/generators.md
@@ -8,6 +8,7 @@ After reading this guide, you will know:
* How to see which generators are available in your application.
* How to create a generator using templates.
* How Rails searches for generators before invoking them.
+* How Rails internally generates Rails code from the templates.
* How to customize your scaffold by creating new generators.
* How to customize your scaffold by changing generator templates.
* How to use fallbacks to avoid overwriting a huge set of generators.
@@ -340,6 +341,20 @@ 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`.
+Many scaffold templates in Rails are written in ERB tags which needs to be escaped, so that the output is a valid ERB code, that can be used correctly in Rails app.
+
+The following code in one of the generator file,
+
+```ruby
+<%%= stylesheet_include_tag :application %>
+```
+
+when passed through the generator, would generate the following output.
+
+```ruby
+<%= stylesheet_include_tag :application %>
+```
+
Adding Generators Fallbacks
---------------------------