Ruby on Rails Sunday, February 25, 2018

No not the rails console!

ERB stands for Embedded Ruby!

You know when you do rails generate controller abc def

you get a file  def.html.erb

that's an ERB file, an Embedded Ruby file

The contents of that file get preprocessed , such that anything outside of <%..%>  gets outputted, and anything inside <%...%> gets executed and <%=....%> involves execution and a result outputted.

PHP has a similar concept.. PHP though also has a PHP.EXE file that you can run a file through and get the output.

I see it now, it's mentioned here 

https://stackoverflow.com/questions/980547/how-do-i-execute-ruby-template-files-erb-without-a-web-server-from-command-lin


C:\Ruby24-x64\bin>dir erb.* /s/b
C:\Ruby24-x64\bin\erb
C:\Ruby24-x64\bin\erb.cmd

C:\Ruby24-x64\bin>


C:\blah>type a.erb
<%= 5 %>
C:\blah>erb a.erb
5
C:\blah>




On Sunday, 25 February 2018 17:49:07 UTC, Mauro Locatelli wrote:
rails console?

Il 25 feb 2018 6:46 PM, "Robert Phillips" <robert.p...@gmail.com> ha scritto:


On Sunday, 25 February 2018 17:29:36 UTC, Hassan Schroeder wrote:
On Sun, Feb 25, 2018 at 9:08 AM, Robert Phillips
<robert.p...@gmail.com> wrote:

> Is there a command line ERB?

I suspect you're looking for "irb" -- Interactive Ruby.

No, ERB is not IRB.  ERB is called Embedded Ruby,  people often use it when they use Rails.

 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/048722b9-806b-4f4c-8443-c5de43785a59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/55a7aacd-79e0-41d1-beaf-8725f1e7d3ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment