Binary Code

A whole lot of nought thought by Chris Cummer

Rails 3.1, Deprecation Warning, and Primary_key_name

We’ve spent the past couple days upgrading the Travergence site from Rails 3.0 to 3.1 and while it hasn’t been entirely smooth, it hasn’t been horrible either. Except for one issue:

1
DEPRECATION WARNING: primary_key_name is deprecated and will be removed from Rails 3.2 (use foreign_key instead).

This would cause recursion somewhere in the stack, eventually leading to:

1
SystemStackError (stack level too deep)

After much digging, googling, commenting-out of code, and swearing I finally figured out that it was rails3_acts_as_paranoid causing the issue. One more google led to this solution by Chris Hilton, which involves patching rails3_acts_as_paranoid to prevent circular aliasing.

Hopefully Gonçalo Silva will fix it in the official branch on Github. Until then you can either fork and patch it yourself or grab ours:

1
gem 'rails3_acts_as_paranoid', :git => 'git@github.com:travergence/rails3_acts_as_paranoid.git'