10

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?

asked Mar 4, 2010 at 17:03

8 Answers 8

15

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!

answered Mar 4, 2010 at 17:11
Sign up to request clarification or add additional context in comments.

2 Comments

You are right. Since I want to learn Ruby, I think including Rails would hide some complexity that is not good for a learner.
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.
6

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.

answered Mar 4, 2010 at 17:30

Comments

4

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.

answered Mar 4, 2010 at 17:13

Comments

3

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" :)

answered Mar 4, 2010 at 17:07

4 Comments

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

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/

answered Mar 4, 2010 at 17:14

Comments

1

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.

answered Mar 4, 2010 at 17:08

Comments

0

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

Sinan Ünür
118k15 gold badges201 silver badges347 bronze badges
answered Mar 4, 2010 at 17:11

Comments

0

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.

answered Mar 4, 2010 at 17:16

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.