refactor rails model user.rb and remove unused code parts