Fix deprecation warning on Rails 3.2
Fix tests