Rails 4 compatibility and clean