What Advice Would You Give A Rails Newbie?

I'm new to Ruby and to Rails, but have been very impressed by the tutorials I've gone through for each. They have convinced me that these are the best tools for the solutions I need to create, but before I really got started, I thought I'd query the wisdom of this list.

Note, I plan on starting with Ruby 1.9 and Rails 3.0.

Is there a better template engine than the default ERB? What do people suggest?

Is there an overview of best-practices when it comes to User management and account authorization and authentication? Is there a gem that I should look at that may implement some of this?

Are there other issues or best-practices that I should know about or gems that you would suggest I investigate?

Thanks, Brad

I'm new to Ruby and to Rails, but have been very impressed by the tutorials I've gone through for each. They have convinced me that these are the best tools for the solutions I need to create, but before I really got started, I thought I'd query the wisdom of this list.

Always good to hear someone excited about Rails!

One bit of 'wisdom': the out-of-the-box Rails defaults are very capable. We've all written substantial apps using bog-standard ERb and Test::Unit, so don't feel pressured to use fashionable alternatives just because they're fashionable. Of course, if you're keen to learn and try out new stuff, then go for it, and use things that stick and make sense for you.

With that said...

Is there a better template engine than the default ERB? What do people suggest?

For a less repetitive and more structured templating experience, Haml is pretty popular these days:

http://haml-lang.com/

Is there an overview of best-practices when it comes to User management and account authorization and authentication? Is there a gem that I should look at that may implement some of this?

The Rails Security Guide has a fairly good section on User Management:

As for gems/plugins, I've lately seen a lot of projects using Authlogic:

It's well designed and extensible, and you should be able to get up and running pretty quickly.

It's an instructive exercise to try writing a basic user auth system, though, even if it's just once as a toy project. You just need methods in the User to hash their password (with a salt, of course), and to look up a user based on a supplied username and password. And then some convenience methods in the controller to store the logged-in user in the session object. It's good to have an understanding of how the basic pieces fit together, so that the gem you end up using isn't just a piece of 'magic'.

Are there other issues or best-practices that I should know about or gems that you would suggest I investigate?

You might want to explore RSpec as an alternative test (sorry, behaviour) framework -- it's very popular, and provides a new perspective on testing. Again, not required; just interesting.

Chris

Here are some other resources you might want to look into:

# see what gems/tools other uses * http://ruby-toolbox.com/

# various screencasts * http://railscasts.com/ * http://rubytu.be/ * Podcast Hosting and Analytics - Welcome to Fireside! * http://www.rubypulse.com/

# other * http://rails-bestpractices.com * http://edgeguides.rubyonrails.org/

Enjoy :slight_smile:

Great stuff so far. Thanks Chris & Gudleik!

Brad

Chris Mear wrote:

I'm new to Ruby and to Rails, but have been very impressed by the tutorials I've gone through for each. They have convinced me that these are the best tools for the solutions I need to create, but before I really got started, I thought I'd query the wisdom of this list.

Always good to hear someone excited about Rails!

One bit of 'wisdom': the out-of-the-box Rails defaults are very capable. We've all written substantial apps using bog-standard ERb and Test::Unit, so don't feel pressured to use fashionable alternatives just because they're fashionable.

At the same time, don't get wedded to the defaults just because they're the defaults. I hope I never again have to use Rails' standard test framework for new development -- the Test::Unit API is crap, and fixtures are somewhere between moronic and dangerous. The Rails team broke some great new ground with the testing framework, but like all pioneers, they made some big mistakes.

Best,

I found a couple of good books, Simply Rails 2 by Lenz is my favorite. Of course it's for Rails 2. You may have to wait for a while for the new crop of Rails 3 books to come out. Or try to update the examples to work in Rails 3.

Judging by your questions about template engines and user management, I'd recommend a more advanced book like The Rails Way.

Other than that, try to build your own app. Nothing really works better than that.

I found a couple of good books, Simply Rails 2 by Lenz is my favorite.

That was pleasing to me to know; I have a Books24x7 subscription, so I selected (the newest, I think) book on Rails from the selection available to me, which turned out to be Patrick Lenz's Simply Rails 2. :slight_smile:

Judging by your questions about template engines and user management, I'd recommend a more advanced book like The Rails Way.

Would you say that "The Rails Way" would be a good follow up to Lenz's book? I'm about 75% through it, so I should perhaps think about 'what to do next'. :slight_smile:

My thanks for Brad for great question; All sorts of useful information about resources in the responses.

Iain

The Rails Way is a really nice read, go ahead. You could also look into the RSpec book from Pragmatic Programmers. It’s very good.

Best regards

Peter De Berdt

My first Rails projects were built ignoring the concept of automated tests. The result was a lot of manual checks and debugging whenever changes were required. If I could go back in time, and were just starting out with Rails, I wouldn't make this mistake again. Getting a good grasp on something like RSpec early will provide you great benefits and save you much in the way of time and hair.

The RSpec book looks very promising.

Bob