Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

410
Vistas
JSONAPI-Resources: NameError could not find resource

I am using JSONAPI-Resourcs an API project. When I try and namespace it I hit an error where the server won't start. Digging in deeper when I run bin/rails zeitwerk:check I get the following error:

NameError: JSONAPI: Could not find resource 'api/v1/connectors'. (Class Api::V1::ConnectorResource not found)
/Users/David/Code/Ruby/my_project/config/routes.rb:7:in `block (3 levels) in <main>'
/Users/David/Code/Ruby/my_project/config/routes.rb:6:in `block (2 levels) in <main>'
/Users/David/Code/Ruby/my_project/config/routes.rb:5:in `block in <main>'
/Users/David/Code/Ruby/my_project/config/routes.rb:3:in `<main>'
/Users/David/Code/Ruby/my_project/config/environment.rb:5:in `<main>'
/Users/David/Code/Ruby/my_project/bin/rails:5:in `<top (required)>'
/Users/David/Code/Ruby/my_project/bin/spring:10:in `block in <top (required)>'
/Users/David/Code/Ruby/my_project/bin/spring:7:in `<top (required)>'
Tasks: TOP => zeitwerk:check => environment
(See full trace by running task with --trace)

Simply from trying to add a namespaced resource as per the guide. If I remove the namespacing it works like a charm.

connectors_controller.rb

module Api
  module V1
    class ConnectorsController < ApplicationController
    end
  end
end

connector_resource.rb

module Api
  module V1
    class ConnectorResource < JSONAPI::Resource
      attributes :name, :description, :save_path, :created_at, :updated_at
    end
  end
end

routes.rb

Rails.application.routes.draw do
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
  namespace :api do
    namespace :v1 do
      jsonapi_resources :connectors, only: %i[index show]
    end
  end
end
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I think you are misplacing the resources, The actual path for resources should be under

resouces/api/V1/some_recource.rb

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda