From: Chad Perrin Date: 2012-01-25T05:20:51+09:00 Subject: Re: Web Application from Scratch - like PHP On Tue, Jan 24, 2012 at 03:35:35PM +0900, Gaurav C. wrote: > Hi, > > I come from a PHP background. I've created many web apps in PHP, using > simple self-made ORM classes and also other popular open-source > frameworks. > > I intend to learn Ruby thoroughly before jumping to any Ruby web > framework. How do I create simple web applications using plain Ruby (and > a server like WEBrick of course)? I learnt PHP by creating simple > classes that could read stuff from and add to the database. Once I was > through with this, I started learning other major frameworks in PHP > (like Yii). I think it will be best to learn Ruby the same way, once I > know the basic concepts of it. > > How do I go about this? How can I create a very simple web app in Ruby, > with a few classes that can talk to the db? You might want to look at Ruby's CGI library, and possibly do some reading about eruby (hint: eruby is more of a concept than a singular thing, with multiple implementations). CGI provides a lot of markup related functionality (generating DTDs and markup, handling POST requests, et cetera), while eruby provides templating similar in many ways to what is the norm for PHP web development. For database connectivity without using big frameworks like Rails (or even small frameworks like Sinatra, which might be a good stepping stone between the Ruby basics and Rails as well as being useful in its own right as a good framework), look into things like the pg (aka ruby-pg), sqlite, and sequel libraries. This is, of course, far from comprehensive. It's just suggestions for where to start looking. Armed with some useful terms like these, Google can be your friend in making early progress. Good luck. -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]