1 year ago

#75670

test-img

TPR

Incomprehensible Routing Error in Postman test

I want to test the result of a controller#action (def show) render in a new directory, using Postman. For this purpose, I made the exact same request in Postman, and copied the same controller to the new directory (also modified the namwspace of the header to the new directory name). Finally, I added a new path to the route corresponding to the new directory.

However, when I send request in Postman (http://localhost:8000/api/v2/employers/444/jobs/4830?include=job_applications), I get No route matches [GET] "/api/ v2/employers/444/jobs/4830"Error. The following is part of my route setup, am I overlooking something?

Rails.application.routes.draw do
(...)
namespace :v2 do
      resources :employers, only: [:show] do
        resources :statistics, only: [:index], controller: 'employers/statistics'
      end

      resources :jobs, controller: 'employers/jobs' do

        collection do
          patch 'renew', controller: 'employers/jobs'
          get 'state/:state', controller: 'employers/jobs/state', action: :index
        end

        member do
          put 'state/:state', controller: 'employers/jobs/state', action: :update
        end

        resources :job_applications, controller: 'employers/jobs/job_applications' do
          collection do
            get 'state/:state',
                controller: 'employers/jobs/job_applications/state',
                action: :index
          end
        end
      end
     
    end
 end

ruby-on-rails

ruby

postman

0 Answers

Your Answer

Accepted video resources