Forum: Ruby on Rails Beginner Question - <% ... %>

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
65b23f7757747463b55afc326956d27d?d=identicon&s=25 Bihal (Guest)
on 2006-04-28 05:20
Regarding: <% (some code) %>

I have some suspicions/general ideas about what this contruct is
supposed to do, but can someone

a) tell me what it's proper name is and
b) explain or point me to a resource which defines it in a formal way?

Thanks in advance,

Bihal
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-04-28 07:40
(Received via mailing list)
On 4/27/06, Bihal <wmioch@hotmail.com> wrote:
> Regarding: <% (some code) %>
>
> I have some suspicions/general ideas about what this contruct is
> supposed to do, but can someone
>
> a) tell me what it's proper name is and
> b) explain or point me to a resource which defines it in a formal way?
>
> Thanks in advance,
>

This (arbitrary, in a sense) syntax is used by ERb (Embedded Ruby), a
part of the Ruby standard library. The idea, basically, is to let you
run Ruby code inside of some other kind of document, be it HTML, plain
text, or even source code for another programming language, like
Javascript.
You can read the documentation here:
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/index.html

The only name I'm aware of for <% %>, <%= %>, etc, is 'ERb tag'.
If it has another name, I'm not aware of it.

Rails uses this system for its templates by default, but there are
other choices, including Markaby and Liquid.
This topic is locked and can not be replied to.