tags:

views:

144

answers:

8

I want to write a web application and want to use Ruby. I have no knowledge of Ruby as of now and I want to write this app. to learn Ruby.

Is Ruby alone sufficient to write a web application or Rails need to be included?

+2  A: 

Yes, you can, depending on your development environment. The most common approach that doesn't use any framework, such as Rails, is to use Apache with modruby/eruby. See http://www.modruby.net/en/ for more information (also wikipedias eruby entry: http://en.wikipedia.org/wiki/ERuby)

And, technically speaking, Rails is just a framework written in Ruby, so it's technically still "just ruby" :)

Matt
Can I use any other web server other than Apache?
RPK
Yes you can. I'd highly recommend Mongrel. But there's some other you could use
Marcos Placona
You can also use Litespeed, it supports Rails and generic Ruby. It has a free standard version.
Xorlev
you can write a cgi application and use almost any webserver
johannes
+1  A: 

Ruby is sufficient, but I wouldn't recommend it. I would recommend working with a framework until you're comfortable with Ruby.

You may want to start even smaller though.

Xorlev
+1  A: 

I would definitely use Rails if I were you. Although you can build a website using only Ruby, it's a bit overkill, and you sure can get a lot more using Rails.

A great start for learning Rails (that's where I started) is:

http://headfirstlabs.com/books/hfrails/

There's a few chapters in there you can read. It's really good, and will give you a nice and solid introduction.

Edit

Also, you can use Mongrel, Webrick, lighttpd, Apache etc with it with no problems

Marcos Placona
+7  A: 

You sound like you're interested in writing something in a barebones fashion.

For that then the Sinatra framework might be more approachable.

You could also use Heroku's service to make the deployment and hosting of your web application simple. I can't overstate how slick Heroku is - it's a masterclass in design and user experience!

frou
You are right. Since I want to learn Ruby, I think including Rails would hide some complexity that is not good for a learner.
RPK
Sinatra and heroku is the way to go. Rails is amazing, but for learning just plain ruby it's overkill. Heroku is perhaps the easiest hosting solution ever, not to mention it's free for small test apps.
tybro0103
+3  A: 

Here is a list of other frameworks than Rails.

You might want to start with Sinatra : it's really small and lets you focus more on the Ruby-learning than on the framework-learning.

subtenante
+2  A: 

Ruby is sufficient but you would have to wire the http server (like webrick/apache/mongrel) with the application you are writing by yourself.
I'd recommend, as to avoid this wireing, to use a simple basic framework like sinatrarb http://www.sinatrarb.com/

clyfe
A: 

You can start off by checking out Chapter 18 (and the rest) of the "Pickaxe Book" titled Ruby and the Web. You can find the online version here to see the nitty gritty of writing Ruby only scripts for a website. There are many options to choose from, most of which have been already suggested here, that will get your website running much quicker and easier.

+2  A: 

The only thing you need to made a simplest web application with Ruby is rack. It's used by all Framework in Ruby. And all server like Passenger/Thin/unicorn/mongrel are rack compatible.

So you can put the must simplest ruby web application like that :


class HelloWorld
  def call(env)
    [200, {"Content-Type" => "text/plain"}, ["Hello world!"]]
  end
end

But the dynamic system are more difficult. So a framework is really helpful.

shingara