views:

491

answers:

11

I have been doing two projects on Rails which have worked out quite nicely but have in the process reinvented the wheel, running (and hot) water and painkillers which are as I have learned subsequently already present in the framework.

So basically, what is the best way to properly get know all the clever parts in the framework that will save time instead of building functionality yourself that has already been implemented? Reading the docs from page 1 onwards? Is there a particular sample app that exposes everything? A particular open source project? All the railcasts? Or something completely different?

A number of people have suggested a series of books, but I might not have made myself clear enough in what I was looking for. I already have a number of Rails (and one Ruby) books that to different degrees explain the Rails framework but that's not really what I'm looking for. Example:

I coded my own function to pretty print numbers as currencies (actually I extended Object to do that for me) because I had no idea that number_to_currency existed. Now that's not a big deal in terms of time but I am sure that I have done my own methods many times simply because I didn't know a similar rails function existed.

So again, how do I find out that number_to_currency (and the myriad of other functions) exist?

+10  A: 

This is a bit subjective. But if you haven't read Agile Web Development With Rails, I'd definitely recommend that, with the prior understanding that quite a bit of new stuff has been added since then, and the 3rd edition will be coming out very soon to reflect this. Also, Ruby for Rails is great if you weren't already familiar with Ruby.

Other than that, definitely pick a Rails blog and follow it (maybe Railscasts); go back and read the archives.

Last but not least, before you start inventing something, thoroughly google it and/or post on the Rails forum to make sure it isn't already around.

J Cooper
ju
+4  A: 

I second the recommendation for Agile Web Development With Rails, I have the 3rd edition in beta/PDF and it really helped. You find also many guides on this site. Don't forget things like Bort and its fork like this one.

Keltia
A: 

The first good way to get to know Rails is by actually making something in it -- anything really, even just a simple blog or something like that. Doing so will show you what you'll need to know and look up to build a good rails app.

I also have two books I've used to learn Rails: Agile Web Development with Rails by David Thomas and David Heinemeier Hansson, and Beginning Rails: From Novice to Professional by Jeffrey Allan Hardy and Cloves Carneiro Jr.

mipadi
+2  A: 

Time.

Really.

Otto
Interestingly: SO wouldn't let me give the correct, more concise answer of "Time.", because it won't take a single word post.
Otto
+2  A: 

look at Bort, Caboose sample app, some others, then write your own

http://jimneath.org/2008/09/09/bort-base-rails-application/

http://www.railsinside.com/elsewhere/100-7-barebones-rails-apps-to-kick-start-your-development-process.html


I would also look at post-tutorial books like Ediger: advanced Rails, Rappin: Professional Rails, "Art of Rails" (Wrox, can't remember author) Chak/oreilly : Enterprise Rails. Read reviews on Amazon, pick 1 or 2.

Gene T
A: 

"Use the source, Luke." I was just reading an article on the desirability of reading the Rails source as a way to really understand what's going on. Of course I closed that tab before I saw this question....

Charlie Martin
+2  A: 

The previous answers pretty much cover the best there is in terms of resources to learn Rails. But my personal favourite is Ryan Bates' excellent series of Railscasts. Also, Peepcode has some excellent Rails screencasts

He covers pretty much every little thing one is going to need in any Rails project.

As far as books go, Simply Rails 2 was very helpful

krishashok
A: 

I am not sure why the other poster is getting voted down. There is no substitute for actually writing code. Lots of it.

Nathan Powell
A: 

Having a sample project in mind is one of the best ways to start in my opinion. Pick something fun (not a huge idea that you've been dreaming of, but something small and intersting to you) and start working on it!

Some of the sample videos on the Ruby On Rails site along with the Agile Web Dev book really help getting the basics down. When you're trying to solve specific problems, things like Railscasts or Peepcode really really help.

Its sometimes difficult to get things "right" the first time when there are so many ways of doing something with rails. "The Rails Way" book is a good way to find out some of these, but Railscasts cover things the Rails way as well.

A: 

Rails is not trivial, a lot of the magic is hidden.

I'd recommend choosing a project that you're going to do. Do not pick "create a blog" or whatever, choose a real project that you want to see happen. Then read a book like Agile Web Dev with Rails and try to code following the examples and tutorials.

Do not hesitate to spend time to entirely refactor your code to improve what you did. You WILL find out that you did everything wrong and have to redo 50% of your code. It's impossible to get it totally right the first time.

marcgg
A: 

My favorite way is to watch the Railscasts:

http://www.railscasts.com

Mark S.