Reputation: 167
I'm using postman to make a PUT
or PATCH
request, but it says No route matches [PUT] "/api/registrations"
my URL looks like this
http://localhost:3000/api/registrations?id=5&status=approved"
My routes.rb file:
Rails.application.routes.draw do
scope :api do
resources :professors
resources :registrations
resources :schedules
resources :notifications
resources :users
resources :meetings
resources :courses
resources :students
end
end
I have a defined update
method in my RegistrationsController and My POST and GET routes work.
Upvotes: 0
Views: 366
Reputation: 23307
The URL you're using is incorrent. You should not pass id
in query, but in path.
A correct URL is
http://localhost:3000/api/registrations/5?status=approved
Rails sets id as last element of a resourceful route.
Docs say:
resources :photos
(...)
PATCH/PUT
/photos/:id
photos#update
update a specific photo
Upvotes: 2
Reputation: 22296
Run rails routes
on the command line to get the proper URL pattern and it's matching Controller action.
Upvotes: 0