Fix deprecation warning, add backward support for rails 3.2