Fix call to out of scope variable.
Fix Rails 3 compat.