Patrício dos Santos
Joined 11/20/2016
Patrício dos Santos said about 8 years ago on Rails API - Authentication with JWT :

If you prefer, you can use Postman too: https://www.getpostman.com/


Patrício dos Santos said about 8 years ago on Rails API - Authentication with JWT :

First thanks for this video. Helps a lot. 

But I am having a trouble implementing this like.

I have the following Routes:

Rails.application.routes.draw do
    namespace :api, constraints: { subdomain: 'api' }, path: '/' do
        namespace :v1 do
            post 'user_token' => 'user_token#create'
        end
    end
end

With this code, I expect to be able to make a POST request like: POST http://api.domain.com/v1/user_token

But when I try to that, I receive an error: NameError: uninitialized constant API::V1::User

It seams like, its looking for the model `User` on the same namespace. But my model User is not namespaced:

class User < ApplicationRecord
    has_secure_password
end

How can I make it work? What I am missing?

Thanks


Patrício dos Santos said about 8 years ago on Rails API - Authentication with JWT :

I think I found a temporary fix :  https://github.com/nsarno/knock/issues/120


Patrício dos Santos said about 7 years ago on Basic Testing Introduction in Rails :

Congratulations for the 100th video \o/