Join 3,372 readers in helping fund MetaFilter (Hide)


Ruby on Rails Resources?
January 21, 2012 4:25 PM   Subscribe

I'm working on learning Ruby on Rails right now, and I'm starting to feel like I'm in way over my head. For those who have been there, what resources helped you find your footing?

So far, I've gone through the Rails for Zombies and TryRuby screencasts on Code School, plus the entirety of Michael Hartl's Ruby on Rails Tutorial. The latter was especially helpful in getting me more comfortable moving around in Rails, but now that I'm out of follow-along mode, I can do the basic stuff (create an app, add data, retrieve data, etc.) but I get stuck a lot.

For instance, right now I'm struggling with getting a has_many :through relationship to work by adding nested attributes within a form, and Googleing has turned up lots of options, but I can't get any to work in my application. Part of the problem for me is that Rails is so abstract - everything you do involves bits of code in about three different places, and I don't have a solid understanding of how they relate yet. What's doubly frustrating is that I know exactly how to do all this stuff in PHP/MySQL/HTML/Javascript, but the Ruby code just feels opaque. (I don't really have any programming experience, mostly front-end web stuff.)

I've only been at this for a couple weeks, so I suppose I shouldn't expect too much yet. There's a lot I really appreciate about Ruby and I'm willing to keep at it, but I need some good basic go-to resources. Can anyone recommend specific books or online tutorials (recent enough that they use Rails 3) that walk you through this stuff in a clear way?
posted by ella wren to Technology (14 answers total) 33 users marked this as a favorite
 
http://ruby.learncodethehardway.org/

I've heard that this is a good source. Have not used it myself.
posted by dfriedman at 4:40 PM on January 21, 2012


Ruby
http://rubylearning.com/
http://ruby-lang.org/en/documentation/quickstart/
http://ruby-doc.org/docs/ProgrammingRuby/

Rails
http://railstutorial.org/
http://railscasts.com/

All of the pragmatic programmer books on Ruby are great:
http://pragprog.com/categories/ruby_and_rails
posted by backwards guitar at 4:56 PM on January 21, 2012


I don't have a specific rails goto, but give it a bit more time and the connections between the pieces (which are really just conventions) should fall into place.
posted by sammyo at 5:05 PM on January 21, 2012


I found Ruby Koans to be excellent. Mandatory hands-on learning:
http://rubykoans.com/

And Project Elur is great for anyone learning any programming language:
http://projecteuler.net/index.php
posted by Ookseer at 5:08 PM on January 21, 2012 [1 favorite]


I have heard good things about The Rails 3 Way by Obie Fernandez. I own it, but haven't read it.

Also, consider going to ruby brigade meetings (if there are any in your area). If you can find one, it will probably have friendly people willing to explain things that you have questions about. The one I go to is full of professional rails developers.
posted by paulus andronicus at 6:14 PM on January 21, 2012


I'm not a rubyist, but _why's poignant guide is excellent.

I would really recommend putting some effort into learning ruby itself rather than rails. Write some command-line things and then adapt them to rails applications. Sinatra is nice and easy, too.
posted by wayland at 7:28 PM on January 21, 2012


I don't have any programming experience and I tried _why's guide and that was too advanced. It's also a bit distracting, IMO.(It is really cool though. It's why I started to learn Ruby.) I started really learning Ruby with Chris Pine's Learn to Program. It's strictly Ruby, however. I don't know how it lays the foundation for RoR. 2nd the Ruby user's group.
Learn to Program has helped me understand the opaque aspects of coding. You get a sense of the tools Ruby gives you to solve problems.
posted by hot_monster at 9:02 PM on January 21, 2012


If you're looking to grasp Rails-ish methodology, with less of Rails' complexity, then building a Sinatra sample app or three is ideal. Once you've got the hang of it, circle back to Rails.

Nth for learning Ruby before jumping into either.
posted by nakedcodemonkey at 10:44 PM on January 21, 2012


Rails is simultaneously one of the best and worst things to happen to Ruby. It's great in that it brings lots of people to Ruby, but it does so with some sort of strange implicit promise that you don't actually need to know or learn any Ruby to do anything with it. And that's very far from true.

There have already been plenty of Ruby recommendations and a couple of Rails ones. One thing that stuck out at me in your question was that "everything you do involves bits of code in about three different places, and I don't have a solid understanding of how they relate yet". And that sounds to me that you're having trouble understanding the MVC architecture behind Rails. I'd hope any book or tutorial on Rails would go over that, but if you want to learn more, you can read up on MVC on Wikipedia.

You can also check out an MVC framework in a different language so you're not learning two things at once. For instance, you say you can do all this in "PHP/MySQL/HTML/Javascript". Does that mean something haphazard, or have you used some good tools using that stack? Doing something with CakePHP might help you better understand Rails.



And yes, if you're going to use Rails, learn Ruby.
posted by cardioid at 11:15 PM on January 21, 2012 [1 favorite]


Having recently started down that road myself, the three tools that are working best for me are railscasts, google and something for regularly scratching my head.

I believe you can get by with a cursory knowledge of ruby. So don't worry too much about that.
posted by seanyboy at 11:40 PM on January 21, 2012


In fact, Rails suits itself to a "Do first then learn" methodology.
posted by seanyboy at 11:42 PM on January 21, 2012


I'm starting to feel like I'm in way over my head. For those who have been there, what resources helped you find your footing?

As a working programmer, I felt this way every single time I'd been working with an unfamiliar technology for a few weeks. And the resource that helped me find my footing, without fail, was simply reminding myself that it took a hell of a lot longer to develop that technology than it would for me to learn it well enough to write code with it, that adding new technologies to their skill sets is just what programmers do, and that completing and then reviewing the one to throw away would always teach me most of what I needed to know.

This reminder works. You need to think about all the things you already know how to do, and remind yourself how long it took to get good at any of them. Just keep plugging away, and filing away better ways to do the things you've already done as you discover what those are.

The other thing that works really really well is finding some way to do a bit of pair programming with somebody else who is already good at whatever it is you're trying to pick up. Anybody truly worth their salary would appreciate the chance to do this with you, because anybody truly worth their salary knows that the best way to improve their knowledge about anything is to teach it to somebody else.
posted by flabdablet at 2:55 AM on January 22, 2012 [4 favorites]


As another working programmer, I confirm what flabdablet says about feeling that way every time and thank him for reminding me of it.
posted by callmejay at 6:30 PM on January 22, 2012


As someone who learned Ruby on his own, I'll third that feeling is always there for me too when working on something new. However, I'll throw in some of my reflections as I learned first Rails, then Ruby, then actually moving away from Rails. First off, I feel your pain. I recall having very similar issues as to you. It seemed like every tiny thing was a google fest, and that was a pain because each version of Rails did it slightly different.

Personally I think you're facing two issues that probably looks like a single issue to you right now. The two issues being ruby as the base language and rails as a web-building domain specific language based on ruby. In the specific example you gave that is a pure Rails issue. has_many :through in Ruby just means execute the "has_many" method with the :through parameter. Rails is what defines the "has_many" logic, and how to interpret ":through". Compounding the issue is that Rails has stuff like this at the model, controller, and view. So your nested forms are a view issue, while your has_many :through is a model issue.

What I'd do in your shoes is first focus on the model and make sure it was doing what I wanted. For me this meant unraveling all the magic that Rails does with commands like "form_for" and replicating it at a more basic level. So if I had a nested form, I'd work out what the inner form was supposed to do and see if I could get the model to do that, then worked out to the outer form. Once I got the model behaving, then I'd work on the view and controller. There were many, many times where I'd give up on the fancy Rails helper and coded things up using almost raw HTML and ERB.

I mentioned that I moved away from Rails. Rails is great if a) you want a dynamically generated website powered by a relational database AND b) you share the same opinions as Rails on how those websites should be designed. For most of the things I was doing, I could get by with a static html/javascript site using Ajax for any backend interactions (i.e. dynamic rendering was done client side rather than server side), plus I really didn't need a relational database, I just needed organized persistent storage, and my model logic could handle the few relational issues. This meant that 90% of rails really wasn't that much help to me, and Sinatra was a much better (and easier to understand) fit.

Feel free to memail me if you run into other issues, especially if they're ruby related.
posted by forforf at 10:28 AM on January 23, 2012


« Older Help me do a better job of pho...   |  IShouldKnowThisFilter: What ar... Newer »
This thread is closed to new comments.