Upgrade to Rails 1.2 notes

in
As I was looking to upgrade applications to rails 1.2, I wrote down all changes I had to do, and post those here in the hope it can be useful to anyone. I have skipped rails 1.1 for some apps and upgraded from rails 1.0, so some (all?) of the points could be from differences between rails 1.0 and 1.1. The first thing is that apparently the name of model classes have to be named very precisely, and there's now a check to see the class was loaded correctly. This caused a problem for the class I had defined in the file app/model/user2address.rb. I (or the generator?) had named the class User2Address, and rails 1.2 checks if the class User2address was loaded (note the capitalisation difference of the a of address). This problem was corrected by simply adding one line:
User2address = User2Address
I'm using the tablefunc contrib of Postgresql, and this requires to define some functions (implemented in a C library) in the database. For the tests to run fine, and have the necessary functions available, I needed to run rake db:test:clone_structure to prepare before running the tests. I had to delete and reinstall the seleniun on rails plugins.
rm -r vendor/plugins/selenium*
script/plugin install http://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails
I used the String.random method from the nano, now facets library. This seems to not be available in the facets gem I installed, so I reimplemented it myself. I had to replace some assert_tag tests conditions from a string to a regular expression. Seems it was checking on substrings, but doesn't anymore. I had a boolean attribute of a model I used as o.boolean? and I've had to adapt it as o.boolean!='f' (as I'm using Postgresql) The image_tag helper now adds an asset_id at the end of the src, resulting in something like
. This can be found at action_view/helpers/asset_tag_helper.rb line 214 (for the whole call stack, in order: lines 185, 155, 200, 212). I guess this is done to avoid caching problems. The part added is either the environment variable ENV["RAILS_ASSET_ID"] or the File.mtime result. This change made that I had to adapt some tests to make it work fine again. I had tests that included the src of the image tag generated. I adapted the tests to work with regexps on the src check:
 :src => Regexp.new("/images/icon/big/use.png(\\?\\d+)?")
That's it, all tests pass again. I hope this can help some people out there encountering the same problems