Rails 2.0 - What's a Newbie to Do?
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:
- 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.
- 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 scaffoldingOther 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 listto see if one of the available plugins looks like it might provide a missing feature.
gem install rails --version 1.2.6Then, 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_projectMost 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.
In correct book title
Chu Yeow Cheah
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.
openrorbook = (german) Rails 2.0 Book also for beginners
Rails 2.0 Screencast and Tutorial
Dmytro Svarytsevych Oct 30, 2014