defined methods in user.rb instead writing methods in controllers