

Learning Ruby and Rails, where would you start? - ahmicro
http://ontwik.com/ruby/learning-ruby-and-rails-where-would-you-start/

======
andymoe
If you have done some web development before (maybe python, maybe php, maybe
ASP 1.0) go read the getting started guides and get rolling. It's a big
framework and there is a lot there but if this not your first rodeo it's not
going to take long to get it. You know what MVC is and rails is just anther
(good) web framework with some nice code generation to start you off fast. Oh
and that ORM can be handy too!

If you are new to Ruby or web dev I would suggest you first start with Sinatra
(<http://www.sinatrarb.com>

That will give you an idea of what basic basic web dev looks like in ruby
without the overhead of a huge framework to take in.

After you have a simple hello world running with Sinatra then see about adding
an external gem. (Maybe the 'shotgun' gem mentioned on the Sinatra site) then
learn about bundler <http://gembundler.com> and get Sinatra running with that
setup. Look at the template languages (erb, haml) and play with those. When
you find yourself playing with middleware then maybe look at rails and see
what it has to offer. At this point you will already have a felling for how
everything fits together with a rack based web app (Sinatra and Rails both use
Rack) at a little lower level and I think you will have a better experience
with rails and be more productive because of it.

EDIT: Submissions that have links to articles with questions marks in the
title are annoying. Thought it was an ask HN at first.

~~~
sradnidge
>Submissions that have links to articles with questions marks in the title are
annoying. Thought it was an ask HN at first.

Agreed, so did I!

------
sradnidge
In all honesty, I would forget about Rails unless you have a really, _really_
compelling reason to pursue it. Rails is such a big framework, you could
easily spend as much time learning it (Rails) as you would learning Ruby
itself. I would recommend starting with Sinatra and Padrino for Ruby based web
frameworks, you'll likely find you never need anything more unless you get a
job at a Rails shop.

In terms of Ruby itself, having picked it up myself only fairly recently I
would recommend the following:

\- unless you plan on maintaining someone elses code, jump straight into Ruby
1.9.

\- hang out in the IRC channels, #ruby-lang and #sinatra on Freenode. The
community is awesome and really helpful.

\- the Sinatra video from Peepcode is really good

\- for books, I would recommend "Cloning Internet Applications with Ruby"
(ISBN 978-1849511063), "Beginning Ruby from Novice to Professional, 2nd Ed"
(ISBN 978-1430223634) and of course the current version of the Pickaxe book
(google it :)

\- check out thechangelog.com regularly if you don't already

That's about it, good luck with it - I've found it fun so far and am currently
developing my first web app on top of Sinatra which i hope to launch in a
month or so!

~~~
mtkd
Personally, if you want to learn something - jump in and learn it - do what
interests you.

I started with Rails first (someone sent me a PDF of an early Rails manual - I
started skimming it about 8am, finished the entire book of 300+ pages by
supper - not sure I even ate anything in-between).

After playing with Rails for a few months I started to look at Ruby itself -
it's an awesome language.

~~~
sradnidge
Absolutely - i guess I was more just saying think about the reasons first.
When I started I was set on Rails too, purely because that's the thing most
people talk about and for newbies it's easy to just see it as "the done thing"
if you know what I mean, and not look for alternatives. I got onto Sinatra
when I quickly realised Rails was way too heavy for what i wanted to do.

But you're absolutely right, the best way to learn anything is to just jump
in, and absolutely nothing wrong with Rails!

~~~
frankdenbow
I have had the same path that you describe. Started learning Rails and quickly
realizing that Sinatra handles most of my needs, and is faster to get started
with. It is also helpful to separate my ruby learning with understanding the
rails framework. Will check out those resources!

------
nhebb
A list of resources from the video:

Web resources:

\- <http://guides.rubyonrails.org>

\- <http://peepcode.com>

\- <http://railscasts.com>

\- <https://github.com/edgecase/ruby_koans>

Books:

\- [http://www.pragprog.com/titles/rails4/agile-web-
development-...](http://www.pragprog.com/titles/rails4/agile-web-development-
with-rails) : _Agile Web Development with Rails_

\- <http://pragprog.com/titles/ruby3/programming-ruby-1-9> : _Programming Ruby
1.9_ (Pickaxe book)

\- [http://www.amazon.com/Rails-Way-Addison-Wesley-
Professional-...](http://www.amazon.com/Rails-Way-Addison-Wesley-Professional-
Ruby/dp/0321601661) : _The Rails 3 Way_

~~~
tvon
Holy crap, thank you. Screencasts are great and all but I'll take text over
video almost anytime when it comes to programming tutorials.

On a related note, I was recently directed to <http://asciicasts.com/> for
railscasts in text format... quite nice.

------
telemachos
Depending on how much or how little you know, this may be useful: Roadmap for
Learning Rails[1].

In some sense, it's an ideal and you could probably learn some of these things
at the same time. That said, if you know _nothing_ about HTML or SQL or
<insert many other things here>, you're going to find Rails overwhelming and
simply not get a lot of what you're doing. (Maybe that's fine too. Dive in,
get lost, figure out parts of it. Lather, rinse, repeat. Some people probably
learn this way, but some people no doubt like things a bit more orderly.)

[1] <http://techiferous.com/2010/07/roadmap-for-learning-rails/>

------
dtegart
Michael Hartl's Rails Tutorial is a good start
<http://ruby.railstutorial.org/>

Also Railscasts is a fantastic resource.

~~~
craftsman
Definitely check out the Rails Tutorial. There is a book (paper or bits), and
really nice screencasts. The thing I like about Michael Hartl is he is really
down to earth, fun, and acknowledges in the video if he doesn't know
something. I bought the PDF and screencasts and am working through it right
now--I'm on chapter 5.

Then, you and a friend should go build something!

------
jot
I would recommend the following online tutorials. My wife, who'd done a little
Java before, became a Ruby fan in an evening thanks to these:

<http://tryruby.org/>

<http://railsforzombies.org/>

~~~
shaggyfrog
I found Rails for Zombies big on theme but very small on substance. By the
end, I asked myself... what did I actually _create_? Nothing! I typed in a few
things into a Web browser that did some monkey-magic on the backend to tell me
if what was in the textbox was "correct". They kept saying we were going to
build "Twitter for Zombies", but I never did. What a let down.

------
glenjamin
I would emphatically recommend that if possible you attempt to give yourself a
good grounding in ruby metaprogramming _before_ learning rails.

It will help you greatly in understanding how and why rails works the way it
does.

The rails internals contain lots and lots of "magic" stuff, which if rails is
your first introduction to ruby, you will find you have trouble
differentiating what is ruby and what is rails's magic.

~~~
stephth
Are there any definitive resources to understand how Rails uses
metaprogramming? I once failed in an attempt to understand the scope of
metaprogramming in Ruby by searching for information in the pickaxe book (but
gave up way too soon to be fair).

~~~
glenjamin
I'm not really sure, there's an O'reilly book "Metaprogramming Ruby"
(<http://oreilly.com/catalog/9781934356470>) which i flicked through once. It
seemed to mostly dicuss how ActiveRecord works. At the point I had access to a
copy I was already pretty familiar with the concepts, so can't really say how
good the book actually is.

I mostly picked things up by reading code and some blog posts whenever I came
across an odd idiom.

------
oliland
I tried to learn Ruby and Rails at the same time, but found it stressful to
learn Ruby's elaborate syntactic sugar and Rails' enormous API at the same
time. For me it certainly helped prototyping my application in Sinatra first
and then dive into Rails once I understood more quirks of the language and
it's web stack.

------
mtkd
Everything you need is here:
<http://guides.rubyonrails.org/getting_started.html>

Those guides are an exercise in best practice framework documentation.

~~~
xiaoma
That's exactly where I started when trying to learn rails the first time and
it was an utter failure that consumed an entire vacation and didn't really get
me very far.

About a year after that I tried O'Reilly's HeadFirst rails book and got much
much more out of my effort.

------
craftsman
I would also add the Pragmatic Programmer's _Agile Web Development with Rails,
4e_.

~~~
bdickason
Seconding this, I've been reading this off and on for the past week and found
that it was perfect to get me started.

------
kinofcain
+1 on all the various comments recommending learning Ruby first and then
Rails.

The Ruby standard library is pretty big, and the language has a large number
of syntax options, which means that there are often 30 different ways to do
something, and you'll often see over half of those in the real world. Those
various options can be undeniably handy at times, but even after working in
Ruby for several years it's not uncommon to come across code that uses
something you haven't seen before.

Rails is great, but it's quite large and also quite clever, and clever can be
very difficult to understand unless you have a solid grasp of the language.

Starting with something simpler like Sinatra would be a great idea, but I'd
still recommend going through a Ruby book first.

The most difficult thing for me learning Ruby on Rails was separating what
cleverness was coming from Ruby and what cleverness was coming from Rails,
learning as much as you can about ruby first would be a huge help.

------
tluyben2
I would recommend learning Ruby (if you don't know it already; if you come
from other imp. languages, don't fall for the trap that 'it kind of looks the
same' ; sure it does, but unless you learn a lot of the great syntax and
language features, you won't be having too much fun imho) and then just
starting a medium sized project for yourself to find out how rails works.
Whatever you want to do, you can find it on Google; study the solution, try it
out, tweak it to what you want to achieve. During such a project, you'll learn
fast about practical Rails things. You might end up loving or hating it ;)

Edit: tutorials didn't help me much; they all blabla about the crud stuff
which is boring as you'll probably never use it. That's why I suggest _not_
going that route.

------
anulman
I actually went through this recently. Here's what took me from zero-to-
functional-prototype in 6 weeks.

 _Note: I had a_ bit* of Python scripting experience, and knew my way around
HTML and CSS.*

1\. A friend recommended SitePoint's Simply Rails 2. I went through that
cover-to-cover, googling for where Rails 3 commands differ from Rails 2.

2\. I used an old tutorial for rolling my own user model from scratch (still
in the Sitepoint piece):
<http://www.aidanf.net/rails_user_authentication_tutorial>

3\. I ran "rails new" and started trying to code out what I was imagining.
Anything that Simply Rails 2 didn't teach, I googled (e.g. FB/Twitter
authentication with Omniauth, following/follower "friendship" models, Twilio
integration, etc.).

If you're not coming into this with any scripting experience, I would
absolutely recommend checking out <http://tryruby.org/> first.

------
sayemm
I just started learning RoR recently. As mentioned in the other comments,
Michael Hartl's "Ruby on Rails Tutorial" (<http://ruby.railstutorial.org/ruby-
on-rails-tutorial-book>) and the Rails Guides
(<http://guides.rubyonrails.org/>) are all you need.

The Railscasts are a great resource as well -
<http://railscasts.com/episodes/archive>

And a good starting resource for Ruby is the pickaxe book -
[http://www.amazon.com/Programming-Ruby-1-9-Pragmatic-
Program...](http://www.amazon.com/Programming-Ruby-1-9-Pragmatic-
Programmers/dp/1934356085/ref=sr_1_2?ie=UTF8&qid=1301754318&sr=8-2)

------
minouye
I am a "business guy" who was proficient in PHP. Here's what I did:

\- Bought a beginning Ruby book and gave it a quick perusal to get a handle on
the fundamentals

\- Went through Michael Hartl's amazing Rails Tutorial (I skipped over some of
the detailed sections on testing with the intention of returning at a later
point.)

\- Finally, and most importantly, I converted an old PHP app into Rails. This
helped me to see how what I wrote previously would fit into the Rails way of
doing things.

------
omarqureshi
Mainly for complete beginners, but, learning Ruby and/or Rails is great and
all, however, a lot of beginners tend to not understand the principles behind
web development such as SQL or javascript or security or HTML.

What really astounds me is that people take ActiveRecord at face value and do
stupid things such as Foo.all.sort_by(&:blah) or Foo.all.select {|x| x.stuff
== "term"} and don't understand why it's such a bad idea.

------
Luyt
Well, with _why the Lucky Stiff's 'Poignant Guide to Ruby' of course ;-)

<http://en.wikipedia.org/wiki/Why_the_lucky_stiff>

One of the developers in the video suggested to learn some Ruby first before
diving into Rails.

------
kujawa
After doing Rails for about 4 years, and Django for about 2 months (but I've
been doing python for 10 years now) ... save yourself some pain and learn
Django instead, if you can at all help it.

Ruby's documentation culture is hair-tearingly frustrating. Half a paragraph,
3 examples covering the barest functionality of your module, and pages of
badly-interfaced mechanically-extracted documentation made me want to punch
the monitor several times a day. Oh, but it's got a pretty web-2.0tard design-
minded web site, and of course gitardhub, which is especially a joy if it goes
down during a deploy.

Think I'm exaggerating?

<http://code.macournoyer.com/thin/doc/files/README.html>

------
kongqiu
Starting from zero, I found Michael Hartl's Ruby on Rails 3 Tutorial to be
excellent. YMMV.

------
nraynaud
"Seven Dwarf Mine Station" ?

------
farout
here are the three that within in a month you should be able to write some
sweet apps quickly.

1\. Head First Rails I first poohed this book but I had read 7-8 other books
adn still was confused so I thought what the hell. I did each project several
times and started making changes. Totally awesome especially the ajax
integration parts. This is when I could actually make my own simple apps in
less than a week.

2\. I loved Agile Programming book - totally awesome. Not enough apps though.
Great explanations. Gentle exposure to Ruby.

3\. beginning novice to professional for ruby. I love this book. It is just
plain fun. Good examples. I totally had fun with this. Peter is totally
totally awesome - I wish he would write every tech book!!

Now you have the grounding, start making and asking questions.

What killed me was the UX/UI stuff. Then a friend suggested CSS Mastery book
and using blueprint this got me clued in. Now I was not paralyzed. It was so
awesome to see an app created in literally minutes.

I loved RoR - I miss it terribly. I disliked the community. Fanboyish. It was
like being in all male high school with everyone thumping their chests and no
help.

I still miss it very much. Whenever I code I first think in RoR then do it in
php. My background was coldfusion, c#asp.net, java, etc. I need something dumb
simple and php does the trick. And the people are nice and there are tons and
tons of example to do anything. Also I needed something that is simple to
deploy and maintain. Yeah yeah -RoR is easy to deploy - my first deployment
took me several hours. Whereas php was minutes. In terms of sys admin and
performance and optimization, I rather deal with php. As DBA, I do not really
want an ORM. BTW when you feel good with RoR - check out Enterprise Rails -
wow - good stuff on performance and optimization.

~~~
petercooper
_Peter is totally totally awesome - I wish he would write every tech book!!_

Thanks. This is in the pipeline.

~~~
farout
darn - I feel like a groupie - but it is true. I can't believe you are on
HN!!!

------
insight
tar xzvf Django-1.3.tar.gz

~~~
dimmuborgir
You know, I used to develop web apps using both Django and Rails. What made me
stop using Django was this sheer fanboism by Django community. I couldn't
stand it. Sure, there was a time when Rails devs were known for their
fanboism. But not anymore. I find the Rails community acts a lot matured
nowadays. On the other hand the Django community is going downhill. For every
web framework recommendation question on StackOverflow, its "Django! Django!".
They don't even bother to see the requirements. It gets even uglier on Reddit.
A Django fanboy even bothered to start this site:
<http://ihaterubyonrails.com>

~~~
sagarun
Could you please backup with your claims with some evidence?

~~~
sagarun
May i know what did i post that is irrelevant to this discussion to get
downvoted? You down voted me because i asked for evidence? As a mater of fact
django devs were receptive to Criticism
<http://news.ycombinator.com/item?id=1777403>

~~~
kinofcain
Because responding to someone's statement of opinion with "prove it" isn't an
effective way to further a conversation.

