#42 Mod Ruby (mod_ruby_demo.rhtml and mod_ruby_demo.conf)

CGI is great for many applications. However, sometimes you may want to have files that are mainly HTML, with only subsections that need to be executed by your programming language, Ruby or otherwise. Wouldn’t it be great if you had an HTML tag that meant Start Ruby code now, after which you could add some Ruby code, and then use another tag that meant Done with Ruby code, go back to plain old HTML?

There is such a system, for many languages. It’s the default behavior for the PHP language, and similar systems are available for Perl and Python, among others. One of the systems that does this for Ruby is eRuby, which will be embedded directly within the webserver via the mod_ruby software. ...

Get Ruby by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.