On Sep 28, 11:35 am, SpringFlowers AutumnMoon <summercooln... / gmail.com> wrote: > hm, that's interesting, the program "erb" can already take > > puts "string" > > and output it... No, it can't. The ruby program evaluates that and outputs it separately. It is not part of the string resulting from evaluating the ERB template. > but in a somewhat funny order: > > <%= "haha" %> > > <% puts "so how about this?" %> > > C:\rails\depot>erb try_erb.txt > so how about this? > > haha What's happening here is that while evaluating the ERB template, the #puts method is called...which outputs it immediately. (And as a result, doesn't happen to change the ERB string at all.) Then, later, the template finishes, and has just the contents of "haha". > However, when I use puts "string" in index.rhtml on RoR, it won't get > displayed. So RoR actually uses eRuby but not erb, and both are just > called "Embedded Ruby" as "ERb"? In RoR, you'll see the output of the puts call coming out in your console or logfile (I think); since the output isn't placed in the ERB result string, however, it never gets put in the HTML that is sent to the web browser.