undefined method `time_zone=’ for # (NoMethodError)


I faced this error on OS X – Leopard when I updated my gems and created a new rails project. The problem is that Leopard ships with gem pointing to http://gems.rubyonrails.org ….or you could be on a different platform with the same issue.


Uninstall Rails (Currently 2.0.2 is the latest release)…so anythig > 2.0.2 should be removed.

1. Remove all versions > 2.0.2 (or latest release) of rails (or all other versions if you don’t use them: sudo gem uninstall rails)

2. Make sure the source is pointing to “http://gems.rubyforge.org/” by running gem source. If it is pointing to “http://gems.rubyonrails.org”, remove it by typing the following: sudo gem remove -r “http://gems.rubyonrails.org”

3. Run: sudo gem install rails -v 2.0.2 to install the latest release version

Remember to recreate your rails project for any new projects as they create files that cause problems. For older projects, just making sure the right version is installed should work.

/!\ FAILSAFE /!\ – Mystereous Error Message

If you have ever seen the following error message after adding some functionality:

/!\ FAILSAFE /!\ Thu Apr 24 18:25:01 -0700 2008
Status: 500 Internal Server Error
wrong number of arguments (1 for 0)

You probably added a method called Send which is causing this error to be thrown.
Rename your method to something other than ‘Send’.

ERRNO::EPIPE -> Broken Pipe

Have you ever encountered a ‘Broken Pipe’ error?
It happens when MySQL closes the open connection after 8 hours (By default) or upon restart ing MySQL.

I tried various solutions (None of these worked):

1. ActiveRecord::Base.verification_timeout = 14400
2. Stale database connections should be handled gracefully
3. Irc.freenode.net – #RubyOnRails (Totally crap when you need help!)
4. MySQL connection timeout setting

Finally, I tried reproducing the error in Windows and realized that it didn’t crash!
Hence, I looked into Mysql.rb code and saw the following (for rails 1.2.3, activerecord 1.15.3):
Win32 => VERSION = “4.0-ruby-0.2.6-plus-changes”
Linux => VERSION = “4.0-ruby-0.2.5”

Now, here is the PATCH (required for the Linux codebase):

Go to Mysql.rb => def write(data)

Add the following to the end of the method
errno = Error::CR_SERVER_LOST
raise Error::new(errno, Error::err(errno))


And VOILA a 2 min fix for 3 days of diagnosis…