Implement compatibility with Rails 4 and Devise 3