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