Saturday, January 26, 2008

Practically Rails

I'm spending some time learning Ruby and Rails. The Web today belongs to those that can implement ideas (not just dream them). So I've been dusting off my OO and C++ knowledge which I hadn't used for about 10 years (it's all coming back pretty easily).

I've invested in a couple of books on the subject and one of them is Practical Rails Applications by Eldon Alameda from Apress. From time to time, I'm going to post typos, errata and other notes here as part of this journey.

  • Pg36: The index page that is produced for the today controller with Rails 2.0.2 is index.html.erb instead of index.rhtml The book references and older version.
  • Pg41: The text thats displayed at the end of script/plugin install acts_as_authenticated plugin looks like an error but its not (that part about acts_as being deprecated by restful_authentication).
  • Pg44: paragraph 3 "we're using it [to] call the login_from_cookie
Last night, I got as far as adding user registration and authentication (using the plug in acts_as_authenticated) in chapter 3 of the book. I ran into a few problems related to the mailer initialization. At the same time, I was tracking down a pesky layout issue on the login and signup pages, unrelated to the mailer issue, when I emailed the author, Eldon Alameda. Eldon responded right away and has been very helpful...

It turns out that the book was written based on Rails 1.2.3 while I was running 2.0 Among the changes is the ActionMailer initialization. So to keep moving forward, I decided to downgrade from InstantRails 2.0 back to InstantRails 1.7 and Rails 1.2.8 (close enough to 1.2.3). A lesson learned for being on the bleeding edge (Rails 2.0 was released late Dec - too new for my taste).

I am redoing the steps starting in Chapter 1.

Here's a trap I fell into a couple of times (the last time around, this was the fork in the road that took me down the path to upgrading to Rails 2.0
which proved problematic): You've just installed mongrel and you're all happy and snug and you do mongrel_rails start to see the fruits of your labor but you see this instead !!! Path to log file not valid: log/mongrel.log

Chances are, your mongrel is installed alright. The thing to remember is that mongrel_rails must run from within a rails app directory (if you use InstantRails and you haven't created a project of your own, go to cookbook or typo sample app directories and start mongrel there. Presto!

My current configuration: Ruby 1.8.6 Rails 1.2.3 mongrel 1.1
gem 0.9.2 rake 0.7.2 apache 1.3.33

No comments: