4 ms·
All we need is to be able to drop an .erb file in a server and have it instantly rendered with the same magic of .php files. How hard would that be? Anyone her
by christiangenco 14y ago
All we need is to be able to drop an .erb file in a server and have it instantly rendered with the same magic of .php files. How hard would that be?
Anyone here know how to write plugins for Apache?
- thatjoshguy 14y agoYou just described python cgi scripts
- christiangenco 14y agoAhh! So I was: http://wiki.dreamhost.com/ERB http://wiki.dreamhost.com/ERB Now all we need to do is make this a default .cgi in all apache installations and we're golden.
- grey-area 14y agoInstall eruby binary (example given is ubuntu/apache): sudo apt-get install ruby libapache2-mod-ruby eruby Set up your web server to serve it: AddHandler rubypage .erb .xhtml Action rubypage /cgi-bin/eruby Start writing pages like this: The time is <%= Time.now %>. The first two steps could be completed by your web host, or done by you once. Obviously you might run into performance issues etc (no idea how well this would work on a live server), but that gets you up and running. I would point out that most examples you can think of as trivial as that above could just be done with js anyway though, without any dynamic language server-side - the main reason to use a server-side language is to talk to a db or store data, at which point you probably want a framework anyway. It's already a solved problem really, but people at that level are happy enough on PHP, which for the example above would be almost identical, and for anything more complex a framework is actually useful, and so there's no point in starting this way for many web projects.
- jamesbritt 14y agoAs I recall a big issue with mod-ruby was that it used a single Ruby process for all scripts. That meant if script A decides to rewrite, say, Array#include? to only work with symbols (or whatever), script B now has to live with it.