💎 Ruby on Rails
Beginner
What is ERB in Rails?
Answer
ERB (Embedded Ruby) is Rails' default templating engine. It lets you embed Ruby code inside HTML files using special tags: <%= expression %> evaluates Ruby and outputs the result (HTML-escaped), <% code %> executes Ruby without output, and <%- -%> suppresses whitespace. View files use the .html.erb extension. ERB is compiled to Ruby at runtime. Alternatives include Haml (indentation-based, concise) and Slim (even more concise). Rails also supports Jbuilder and json for API responses.
Previous
What is strong parameters in Rails?
Next
What is the difference between GET and POST in Rails forms?