InfoQ

News

Rails 2.0 - What's a Newbie to Do?

Posted by Rick DeNatale on Dec 27, 2007

Community
Ruby
Topics
Programming ,
Ruby on Rails
Tags
Rails Plugins ,
Documentation ,
Ruby on Rails
With the recent release of Rails 2.0.0, 2.0.1, and now 2.0.2 in rapid succession, the Rails support discussion groups have had frequent inquiries from newcomers to Rails who are having problems following popular tutorials such as the books "Agile Web Development with Rails" by Dave Thomas and David Heinemeier Hansson. The Thomas/Hansson book, which is commonly referred to as AWDR is already in it's second edition which is just about a year old and covers Rails 1.2.

While the difference between Rails 2.0 and its predecessor Rails 1.2 are far less drastic than those between Rails 1.2 and Rails 1.1, enough potholes are there to trip up the unsuspecting newbie.

One of the themes of Rails 2.0 was to make it leaner. This means that some features which were previously standard have been removed from the core and relegated to plugins. For someone following a tutorial based on an 1.2, this can be a stumbling block. Two examples:
  1.  Many tutorials are base on using MySql as the database adapter because it has always been the Rails 'default.' Up to now, that is, Rails 2.0.3 changed the default to Sqlite3. AWDR describes how to use Sqlite3, later in the book, but a newbie following along might not be equipped to troubleshoot the problem without help at the time it's encountered.
  2. The early parts of AWDR make use of the dynamic scaffolding feature of Rails which now is only available after the scaffolding plugin has been installed with:
              script/plugin install scaffolding 
    Other such "missing" features in Rails 2.0 include AJAX in-place-editing and auto-completion, and some of the popular acts_as_x model extensions. Someone following an aging tutorial might try running the command:
              script/plugin list 
    to see if one of the available plugins looks like it might provide a missing feature.
Another option is to use Rails 1.2.6, work through the tutorial(s) and then consider moving to 2.0. First, install the 1.2.6 version of Rails:
    gem install rails --version 1.2.6 
Then, either remove any rails 2.0.x gems you have installed, or specify the version on the rails command when you generate your project:
    rails _1.2.6_ my_rails_project 
Most commands installed by gems are wrappers which invoke the code in the gem, and allow you to specify the version of the gem used by calling them with a version number surrounded by underscores as the first argument.

There are already some books which cover Rails 2.0 available such as "The Rails Way" by Obie Fernandez, but so far they all seem to be targeted as resources for those with a little more Rails experience under the belt. Some of the "Classic" Rails literature will no doubt be updated as time goes on, and newer tutorials will join them.

In the meantime the Rails newbie has the choice of either struggling through the changes as they are encountered, or perhaps more wisely using the version of Rails which matches the tutorial until a certain level of mastery has been achieved.
Misinformations? by Kristof Jozsa Posted Dec 27, 2007 3:55 PM
Re: Misinformations? by Matt Henry Posted Dec 31, 2007 5:15 PM
In correct book title by Nicholas Henry Posted Dec 27, 2007 5:59 PM
Some inaccuracies by Chu Yeow Cheah Posted Dec 27, 2007 8:35 PM
openrorbook = (german) Rails 2.0 Book also for beginners by der kaan Posted Dec 28, 2007 3:09 AM
Rails 2.0 Screencast and Tutorial by Fabio Akita Posted Dec 29, 2007 8:52 AM
Peepcode Screencasts by Matt Henry Posted Dec 31, 2007 5:12 PM
  1. Back to top

    Misinformations?

    Dec 27, 2007 3:55 PM by Kristof Jozsa

    I haven't read it myself, but all the reviews seem to claim Obie Fernandez's book as a throughout one aimed towards beginners. On the other hand, it has been confirmed several times through the 2.0 release cycle since the beta series that the AWDR book will NOT get an update for Rails 2.0.x. I might be wrong in both cases so someone please correct me, as I'd also like to know these for sure!

  2. Back to top

    In correct book title

    Dec 27, 2007 5:59 PM by Nicholas Henry

    You mention the book "Active Web Development with Rails" - the title of this book in incorrect. The correct title is "Agile Web Development with Rails".

  3. Back to top

    Some inaccuracies

    Dec 27, 2007 8:35 PM by Chu Yeow Cheah

    Just wanted to point out some inaccuracies in the article. The new default database of SQLite3 was actually introduced in 2.0.2 (2.0.3 is not out yet). It may have been a bad move publicity-wise but you can simply do 'rails -d mysql myapp' to generate a Rails app pre-configured for MySQL as detailed in weblog.rubyonrails.org/2007/12/17/rails-2-0-2-s....

    Also, dynamic scaffolding is completely deprecated/removed - even installing the plugin you mention will still cause failures in using dynamic scaffolds. Mind you, normal scaffolding still works, just not _dynamic_ scaffolding.

  4. OpenRoRBook is a free German language book that covers Rails 2.0 development. It's availabe on www.rubyonrails.de/newsitems/98. We hope to find someone who have time and fun to translate the book into English in the future.

  5. Back to top

    Rails 2.0 Screencast and Tutorial

    Dec 29, 2007 8:52 AM by Fabio Akita

    I think these can help as well:

  6. Back to top

    Peepcode Screencasts

    Dec 31, 2007 5:12 PM by Matt Henry

    The Akita on Rails screencasts are great. Rails newbies might also check out Geoff Grossenbach's intro screencasts at Peepcode. They come with notes that point out the spots where Rails 2.0 differs from 1.2. Very handy for those just starting out.

  7. Back to top

    Re: Misinformations?

    Dec 31, 2007 5:15 PM by Matt Henry

    The Obie Fernandez book is awesome, but he's careful to say in the preface that it's not really intended for beginners. Most of the reviews I've seen say the same.

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.