Archive for July, 2010

‘Mail’ is a resevered model name in Rails 3

Monday, July 19th, 2010

This may bite you in the ass if you are upgrading a Rails app from 2 to 3: ‘Mail’ is now a reserved model name. That means, if you currently have a model app/models/mail.rb, and/or a class defined as class Mail < AR::Base (for instance), it will collide with the new Mail class in Rails 3, and possibly throw this error

1
undefined method `transfer_encoding' for class `Mail::Message'

That is because Rails defines Mail.transfer_encoding in it’s Mail class, and your’s is over-riding it. The quick fix: rename your class and your file name.

Tags:
Posted in Code | No Comments »