I've learned things like PHP and Flash entirely through poking around online tutorials, but I can't seem to catch on by doing the same with RoR. I guess the philosophy of RoR is drastically different from what I'm used to.
How did you guys learn rails? I really want to learn it, but the tutorials aren't really working for me.
First things: You need to know MVC, and you need to know Ruby. MVC takes a little while to wrap your brain around if you've only ever done things like PHP. There isn't really a great overview document for MVC, but if you do some google searching and wikipediaing, you can find some stuff. Understand what goes in the controller, and in the model, and in the view, and why we bother to separate them.
Then learn Ruby. There are a bunch of resources for this. Why's Poignant Guide is hilarious, but rather opaque. I recommend a book by David Black called Ruby for Rails, but I'm sure O'Reilly has some fine books too.
Now you're ready to start learning Rails. The online documentation is usually poorly organized -- at best. If you can afford it, pick up Agile Web Development with Rails. It's in its second edition now, and is much much better at introducing you to rails than any online resource I've seen. Maybe someone else here can recommend an online tutorial I haven't seen, but they seem to generally be more out of date than the books, rather than the other way around.
Does Agile Web Development with Rails have a section on learning Ruby? I'm wondering if I can kill two birds with one stone with this behemoth of a book
Not really, sorry. If you know Python or a similar language well, you can probably get by without a dedicated Ruby resource, because AWD does have lots of examples, and it has a 13-page ruby tutorial appendix. But I wouldn't recommend it.
"MVC takes a little while to wrap your brain around if you've only ever done things like PHP."
Good PHP code typically uses a MVC architecture as well. The model is the database, the controller consists of PHP files that take your $_GET and $_POST parameters and grab result sets out of the database, and the view is PHP files with no PHP tags besides your basic echoing, looping, and conditional HTML inclusion. Some people prefer to use a templating system like Smarty, which gives a prettier syntax but is conceptually the same.
Good examples are vBulletin, Phorum, and Pligg (well, the Pligg codebase has some other issues, but it's a MVC architecture). Bad examples might be stuff like PhotoPost that mashes all the code together. I highly suspect successful PHP websites like Flickr and FaceBook use a MVC architecture too, but I have no inside knowledge of their codebase.
Rails isn't that hard to learn if you've seen PHP code written like that. A Rails controller is like a collection of PHP entry pages: each method responds to a particular URL, and is responsible for populating dynamic content and rendering a template (which implicitly defaults to the method name). An ERB template is just like a PHP page, but with embedded Ruby instead of embedded PHP. An ActiveRecord object is like a PHP result set, except that changes to the object can be easily reflected back to the database. That's basically Rails in a nutshell.
I did exactly what you advised. Devoured through Ruby for Rails, and I'm about half way through Agile Web Development. I really feel like I'm getting a good understanding of RoR!
I got a consulting project, told the client I was using RoR, and now I'm learning it. I think I've learned just about everything like this, with RoR being the most recent.
Got a book. Read it. Installed it. Followed the demo app. Wrote a small sample app. Wrote a larger sample app. Applied for related jobs. Got a related job. Worked hard. The End?
Same as awt - I built something with it (http://www.charitycheckout.com). It's amazing how building something really helps you focus on the parts of the framework and core language you need to learn.
2. Black's Ruby for Rails (Manning). Read this not long after AWDwR. It provides much insight into the Ruby behind the Rails.
3 (tie). Either Orsini's Rails Cookbook (O'Reilly) (the testing chapter is particularly useful if it's new to you)
3 (tie). Fowler's Rails Recipes (Pragmatic Programmers). Both books are very good. If anything, 'Recipes' gets you movign faster, but you'll probably learn more from the Cookbook.
opt. Ajax on Rails by Raymond (O'Reilly). An in Depth Reference to Prototype, Scriptaculus and rjs. Useful since there is no really good reference on these for the noob.
opt. The Ruby Way by Fulton (Addison Wesley) An 'inside out' Ruby reference. Instead of going through classes and methods on by one, this book is organized by things one can do, with the classes and methods introduced in context. Not so much every day useful- but if you don't have access to a real liver rubyist, it's a good way to see how one might approach a problem.
opt. The Pickaxe 2nd ed (dead tree format). Some folks just like to step away from the computer, and still think about computers.
Other than books:
The google groups for rails:
rubyonrails-talk (general discussion. A great list btw good questions get answered very well usually. No attitude at all.)
rubyonrails-core (the core contributors and rails internals)
rubyonrails-spinoffs (mostly the ajaxy stuff)
rubyonrails-security (created after an incident last year
to spread urgent messages about rails vunerabilities, announcements only)
I just went and built something with it - http://alltimetop5.com
I'm shocking at busy work for no good reason so I had to wait until a good enough idea came along to motivate me. The first version I just threw out, there were too many artefacts left from me stumbling wildly around.
I think that might be the point where you can call yourself proficient at ror, when you finally get how ugly the first code you wrote was :)
I understand what you mean. I am writing my first application in Django without really understanding Python. The result is tragically awkward. But, I have high hopes for the next effort.
I followed through with a couple of online tutorials, then tried making my own app. I found it to be pretty difficult once I got past scaffolding and doing non-cookie-cutter things, seeing as how I didn't know much about the concept of MVC or where the line between Ruby ended and RoR began.
So, I picked up a copy of Agile Web Development with Rails and had at that for maybe a month, then I grabbed a copy of Programming Ruby (the pickaxe book).
I was also constantly asking questions and reading what was going on in IRC in the #rubyonrails room on freenode. Now I lurk around in there and answer the occasional question. Another great help was all of the RoR info being posted on reddit, but that site isn't even a shadow of its former glory now.
If you're more disciplined than I am, learn Ruby first, then learn RoR. Personally, I have a hard time doing that because my mind is always crawling with ideas, so I just dive right in to new things and figure out what I'm doing piece by piece.
For me, the first step was to want to build something. That gave me the drive to want to find out how.
AWDR & Pickaxe are pretty indispensable (although I picked up Pickaxe much later). There are also loads of really great blogs (jamis buck, err the blog ..) and forums (railsweenie, ruby-forum ..) out there worth checking out regularly.
Learn by doing. One way that I do is try to implement existing sites. This lets you concentrate on building the product instead of designing how it will look and feel. For example. Building this site in RoR would be a great exercise as the scope is large enough to include many features but not so large as to be impossible.
28 comments
[ 3.8 ms ] story [ 53.6 ms ] threadHow did you guys learn rails? I really want to learn it, but the tutorials aren't really working for me.
http://www.michaelwales.com/2006/12/ror-education-takes-wrong-approach/
Then learn Ruby. There are a bunch of resources for this. Why's Poignant Guide is hilarious, but rather opaque. I recommend a book by David Black called Ruby for Rails, but I'm sure O'Reilly has some fine books too.
Now you're ready to start learning Rails. The online documentation is usually poorly organized -- at best. If you can afford it, pick up Agile Web Development with Rails. It's in its second edition now, and is much much better at introducing you to rails than any online resource I've seen. Maybe someone else here can recommend an online tutorial I haven't seen, but they seem to generally be more out of date than the books, rather than the other way around.
If you get stuck, here's two links I use the most: http://www.rubycentral.com/ref/ http://api.rubyonrails.org/
You'll find more current info at http://www.ruby-doc.org
Good PHP code typically uses a MVC architecture as well. The model is the database, the controller consists of PHP files that take your $_GET and $_POST parameters and grab result sets out of the database, and the view is PHP files with no PHP tags besides your basic echoing, looping, and conditional HTML inclusion. Some people prefer to use a templating system like Smarty, which gives a prettier syntax but is conceptually the same.
Good examples are vBulletin, Phorum, and Pligg (well, the Pligg codebase has some other issues, but it's a MVC architecture). Bad examples might be stuff like PhotoPost that mashes all the code together. I highly suspect successful PHP websites like Flickr and FaceBook use a MVC architecture too, but I have no inside knowledge of their codebase.
Rails isn't that hard to learn if you've seen PHP code written like that. A Rails controller is like a collection of PHP entry pages: each method responds to a particular URL, and is responsible for populating dynamic content and rendering a template (which implicitly defaults to the method name). An ERB template is just like a PHP page, but with embedded Ruby instead of embedded PHP. An ActiveRecord object is like a PHP result set, except that changes to the object can be easily reflected back to the database. That's basically Rails in a nutshell.
I did exactly what you advised. Devoured through Ruby for Rails, and I'm about half way through Agile Web Development. I really feel like I'm getting a good understanding of RoR!
I want to know how you pulled this off.
But I got it before the current edition came out, so I don't know how it's changed.
-. Skip the Pickaxe book for now, the 1st edition is online at http://www.rubycentral.com/book/
2. Black's Ruby for Rails (Manning). Read this not long after AWDwR. It provides much insight into the Ruby behind the Rails.
3 (tie). Either Orsini's Rails Cookbook (O'Reilly) (the testing chapter is particularly useful if it's new to you)
3 (tie). Fowler's Rails Recipes (Pragmatic Programmers). Both books are very good. If anything, 'Recipes' gets you movign faster, but you'll probably learn more from the Cookbook.
opt. Ajax on Rails by Raymond (O'Reilly). An in Depth Reference to Prototype, Scriptaculus and rjs. Useful since there is no really good reference on these for the noob.
opt. The Ruby Way by Fulton (Addison Wesley) An 'inside out' Ruby reference. Instead of going through classes and methods on by one, this book is organized by things one can do, with the classes and methods introduced in context. Not so much every day useful- but if you don't have access to a real liver rubyist, it's a good way to see how one might approach a problem.
opt. The Pickaxe 2nd ed (dead tree format). Some folks just like to step away from the computer, and still think about computers.
Other than books: The google groups for rails: rubyonrails-talk (general discussion. A great list btw good questions get answered very well usually. No attitude at all.)
rubyonrails-core (the core contributors and rails internals)
rubyonrails-spinoffs (mostly the ajaxy stuff)
rubyonrails-security (created after an incident last year to spread urgent messages about rails vunerabilities, announcements only)
The api docs:
either at api.rubyonrails.org (rails)
or caboo.se (another rails doc project)
www.ruby-doc.org/core (Ruby core)
www.ruby-doc.org/stdlib (Ruby standard library)
Hope this helps,
J.
I think that might be the point where you can call yourself proficient at ror, when you finally get how ugly the first code you wrote was :)
In any case, God help my first child.
Idling on the rails irc channel helped me get through some tough spots. These days there are a ton more resources than there were 2 years ago.
Having a goal seems to help get through the tough or slow-going parts of app development. (i.e. the goal of just finishing & launching it)
So, I picked up a copy of Agile Web Development with Rails and had at that for maybe a month, then I grabbed a copy of Programming Ruby (the pickaxe book).
I was also constantly asking questions and reading what was going on in IRC in the #rubyonrails room on freenode. Now I lurk around in there and answer the occasional question. Another great help was all of the RoR info being posted on reddit, but that site isn't even a shadow of its former glory now.
If you're more disciplined than I am, learn Ruby first, then learn RoR. Personally, I have a hard time doing that because my mind is always crawling with ideas, so I just dive right in to new things and figure out what I'm doing piece by piece.
Agile web development with Rails (for learning rails initially)
Beginning Ruby by Peter Cooper (for learning ruby)
Rails Recipes (for doing useful stuff)
While reading these I also worked on converting an existing web app into rails.
AWDR & Pickaxe are pretty indispensable (although I picked up Pickaxe much later). There are also loads of really great blogs (jamis buck, err the blog ..) and forums (railsweenie, ruby-forum ..) out there worth checking out regularly.
That said I wrote this blog entry a while ago that explains the main resources that i used to learn RoR. http://www.productcriticblog.com/2007/03/top-6-resources-to-learn-ruby-on-rails.html