Lesson plan

ERuby

Embedded Ruby (abbreviated as ERB or eRuby) is a template engine that embeds Ruby code into text documents. It is commonly used to generate dynamic content in HTML documents, which is a role similar to Active Server Pages, JavaServer Pages, PHP, and other server-side scripting languages. eRuby combines Ruby code and plain text to provide flow control and variable substitution, thus making the combined code easier to maintain. In Ruby on Rails, eRuby is commonly used in a view layer in order to generate dynamic web content. The view module of Ruby on Rails is responsible for displaying a response or output in a browser. In its simplest form, a view may consist of static HTML content; however, many Ruby on Rails applications will require dynamic content created by the controller (an action method) to be displayed in their view. This is achieved from Embedded Ruby templates, which allow Ruby code to be embedded within view documents. During rendering, the embedded code is evaluated and replaced with its resulting value at runtime. However, the ability to embed code in a view document risks bridging the clear separation present in the MVC frame. As a result, maintaining clear separation of responsibility among the model, view, and controller modules is left to the developer of the application.

Back to article

Article summary

Embedded Ruby (abbreviated as ERB or eRuby) is a template engine that embeds Ruby code into text documents. It is commonly used to generate dynamic content in HTML documents, which is a role similar to Active Server Pages, JavaServer Pages, PHP, and other server-side scripting languages. eRuby combines Ruby code and plain text to provide flow control and variable substitution, thus making the combined code easier to maintain. In Ruby on Rails, eRuby is commonly used in a view layer in order to generate dynamic web content. The view module of Ruby on Rails is responsible for displaying a response or output in a browser. In its simplest form, a view may consist of static HTML content; however, many Ruby on Rails applications will require dynamic content created by the controller (an action method) to be displayed in their view. This is achieved from Embedded Ruby templates, which allow Ruby code to be embedded within view documents. During rendering, the embedded code is evaluated and replaced with its resulting value at runtime. However, the ability to embed code in a view document risks bridging the clear separation present in the MVC frame. As a result, maintaining clear separation of responsibility among the model, view, and controller modules is left to the developer of the application.

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.