ERB
suggest changeIntroduction
ERB stands for Embedded Ruby. It inserts Ruby values into templates such as HTML and YAML. The ERB class takes text and replaces the Ruby code marked up with ERB tags.
Syntax
- <% number = rand(10) %> this code will be evaluated
- <%= number %> this code will be evaluated and inserted into the output
- <%# comment text %> this comment will not be evaluated
Remarks
Conventions:
- Keep business logic in accompanying helper code. An ERB template should stay readable to someone who does not know Ruby.
- Append files with
.erb: e.g..js.erb,.html.erb,.css.erb, etc.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents