Fix relation code to support Rails 3.2.9.rc1