I have controller:
class Api::V1::Item::ItemsController < ApplicationController def index @items = Item.all render json: @items endend
and routes for this controller:
namespace :api do namespace :v1 do namespace :item do resources :items end end end
If I check this in postman, I obtain an error:
{"status": 500,"error": "Internal Server Error","exception": "#<NameError: uninitialized constant Api::V1::Item::ItemsController::Item>", }
But if I modify controller`s method index like:
def index render json: { check: 'Nice' } end
everything will be fine. Please explain to me what the problem is.