tags:

views:

54

answers:

4

Can embedded ruby (erb) be used outside of rails in regular webpages to dynamically update content (almost as a replacement for PHP)?

+2  A: 

Yes, as long as the pages are processed by a Ruby interpreter.

For instance, the Sinatra framework uses ERB along with other template languages such as HAML and Erubis.

Simone Carletti
+2  A: 

erb is part of the ruby standard library. I would recommend using erubis if possible though, since it is significantly faster (about 3x)

Matt Briggs
A: 

In Ruby off the Rails, one person describes using ERB in a not just non-Rails, but a non-web context - using it to generate text files. I don't know how often people take that approach though.

Andrew Grimm