app/controllers/api/sessions_controller.rb
def create
      user = User.find_by(email: params[:session][:email].downcase)
        if user && user.authenticate(params[:session][:password])
	  user.lastlogin = DateTime.now
	  user.save!
          render :text => user.access_token, status: 200
        else
          render text: "Email and password combination are invalid", status: 422
        end
    end
#If user login data are valid it will return the access_token so the
#client app can use it for future request for the specific user.
If user login data are valid it will return the access_token so the
client app can use it for future request for the specific user.
If user login data are valid it will return the access_token so the client app can use it for future request for the specific user .
def create
      user = User.find_by(email: params[:session][:email].downcase)
        if user && user.authenticate(params[:session][:password])
	  user.lastlogin = DateTime.now
	  user.save!
          render :text => user.access_token, status: 200
        else
          render text: "Email and password combination are invalid", status: 422
        end
    end
def create user = User . find_by ( email : params [ :session ] [ :email ] . downcase ) if user && user . authenticate ( params [ :session ] [ :password ] ) user . lastlogin = DateTime . now user . save! render :text => user . access_token , status : 200 else render text : "Email and password combination are invalid" , status : 422 end end
If user login data are valid it will return the access_token so the
client app can use it for future request for the specific user.
If user login data are valid it will return the access_token so the client app can use it for future request for the specific user .