| home | forums | resources | search | news | join | members: 5931 |
Hiveminds | Sun, 2006-12-10 20:57 tags: Review, Web hosting, eRuby Ruby on Rails is gaining popularity but what do you do if you want to create web pages in Ruby but don't want Rails? The answer is eRuby. But not many web hosting know about eRuby. If you want eRuby then you will have to them ask for it. I found this out by sending a few emails. Here are the results of the survey. A week ago I sent out 10 emails to well known web hosting companies. I got the list from the www.rubyonrails.org. In the email I asked a simple question. "Do you support eRuby?" The answers I recieved were varied. Most of the hosting companies sales people and technicians had no idea what eRuby was although they did support Rails and ERB. Some of them answered back that they did not support mod_ruby which is a totally different thing. So I had to go back and explain to them what eruby.cgi was and how to implement it. After a brief explaination of eRuby and how to get it going I received 6 answers. Of those two hosting companies said that they would install and make available eRuby by request. One did support eRuby already but did not have it listed in available features. This is the explaination that was sent to them, eruby.info. As you may notice we have started a new domain dedicated to the promotion of eRuby. I never thought that it would be necessary but it seems that the noise of Rails is drowning out a greater opportunity for those that are not interested in Rails. Eruby.info is just starting out but it is hoped that it will be a jumping point for all that want to use the Ruby programming language for web developement. There will be a concentration on three things. First an explaination of what eRuby is and how to get it. Second a list of web hosting companies that support eRuby or will install it on demand. This will require a setup that will allow hosting companies to list themselves. Third part will be a repository of web applications that run without Rails. By the way those hosting companies that will install eRuby for you are:
A list of hosting companies that have eRuby installed as standard. There will be more coming as soon as we come up with a letter that both asks and explains eRuby so that we get clear responses and not "we don't support mod_ruby" or "why don't you want to use Rails?" which are the most common answers. eRuby is not eruby and eruby.cgi is not mod_rubyeRuby is the implementation of embedding Ruby code in a nother file using <% ruby code %>. eruby with small letters is the CGI binary that does eRuby. mod_ruby is a complete Ruby core running on Apache. The listed items are three different things. Hosting companies don't seem to really understand what mod_ruby is either. mod_ruby embeds the Ruby interpreter into the Apache web server, allowing Ruby CGI scripts to be executed natively. These scripts will start up much faster than without mod_ruby. This is the same as mod_perl or mod_php. Once all the misunderstandings are cleared and eruby.cgi made available to you then you can get started doing some Ruby web pages. Hosting companies benefit from this because gives a really easy to learn alternative to PHP without them having to install the Ruby on Rails framework. Forms and eRubyEchoing back text is nice, but what about multi-step forms that are included in the same .rhtml file? eRuby handles this in the way one would expect. if/else/unless/elsif sections can span eRuby tags. Take the following simple example: Example 1. if/else eRuby example
On the first page request, the user will be prompted for their username. Upon entering the username and submitting the data, the condition changes, and the contents of the else expression is executed, which, in this case prints out the username. Behind the Scenes of eRubyWhen the Apache handler is called via the .htaccess direction, it does a few things for the developer which make it very easy to use as a dynamic web engine.
DirectoryIndex index.rhtml index.html index.htmeRuby handles sending out the HTTP headers. If there's a server error (syntax, runtime, database, security, etc.), eRuby will perform an internal sub-request to the appropriate 500 error document. eRuby actually inverts the code so that the HTML is wrapped in Ruby, then executes the Ruby. Example 2. Compiled eRuby output before execution
Seeing that eRuby just inverts the code, like what JSP does before it compiles them into classes, is useful when thinking about program structure, control, etc. Switch statements and exception blocks are very useful for multi-step forms and worth holding onto in the back of your mind. Now you can see why eRuby is an important part of the Ruby world and how you can make it work for you without using the Rails framework.
This article brought to you by the
Hiveminds Magazine - Staff. Contact us if you want to post an article or announcement anonymously |
ASP.NET London Hotels
Silverlight Laptop Reviews
Windows Just Dial International Calls
Adobe Flex PHP Excel Training Courses
Joomla! excel courses in london
Content Management Systems Data Recovery
ASP.NET Cheap Personal & Secured Loans
Adobe Flex Joomla! Sell Online
Adobe Flex
|
NewsletterGet updates on Hiveminds services, articles and downloads by signing up for the newsletter. |
Editor's choiceSome of the better articles, stories and tutorials found at Hiveminds. |
Find moreFind more of Hiveminds articles, stories, tutorials and user comments by searching. |
Picked linksHand picked websites and articles from around the web that provide quality reading. |