Help with Scaffolding deprecation on Rails 2.2.2

I am reading “Agile Web D. with Rails, 2nd Edition”, which is
based on 1.2.6. However, on my Leopard based iMac, I was running Rails
2.2.2.

When I got to the part with associating a scaffold to my :products
(located on the bottom of page 67), it outputted a No Scaffold method
error (because scaffolds are not included in 2.2.2).

After searching some web sites, particularly <http://www.ruby-
forum.com/topic/137274>, I tried to install 1.2.6 by issuing: gem
install rails—version 1.2.6—include-dependencies.

This worked correctly, but when I still type check the current version
from bash it states:

Rails 2.2.2

I then went into my app’s config/environment.rb file and set
RAILS_GEM_VERSION to 1.2.6.

When I tried to re-start the WEBrick server, I got the following
error:

=> Booting WEBrick…
./script/…/config/…/config/environment.rb:46: undefined method
time_zone=’ for #<rails::configuration:0x11600c0> (NoMethodError) from /Users/untz/.gem/ruby/1.8/gems/rails-1.2.6/lib/initializer.rb: 45:in run’ from ./script/…/config/…/config/environment.rb:13

On line 46, on my WEBrick server, this is what is set:

config.time_zone = ‘UTC’

Question(s):

(1) Should I stick with learning Rails 2.2.2 and upgrade to Ruby 1.9?

(2) Is the 2nd Edition of this book now deprecated or is there a
workaround to my problem?

(3) Any good resources on learning the new version of Rails?

Happy programming!

On Feb 9, 11:28 pm, untz [email protected] wrote:

On line 46, on my WEBrick server, this is what is set:

config.time_zone = ‘UTC’

just remove that - it’s an option only available with rails >= 2.1
(which was the case when you generated the app, but now you’re trying
to run with an older version)

Question(s):

(1) Should I stick with learning Rails 2.2.2 and upgrade to Ruby 1.9?

certainly don’t skip to ruby 1.9 unless you are using a version of
rails ready for it (which right now means rails 2.3rc1). I would
stick to 2.2.2 if you’re still learning

Fred

Fred,

perhaps creating the app with the version you need will help avoid
this and other issues. You can do it by specifying the version
enclosed in underscores before passing the name of the new app:

rails 1.2.3 mynewapp

Al

On Feb 9, 3:56 pm, Frederick C. [email protected]