2016-12-24 9 views
-2

このエラーをどのようにするには?レールでのルーティングエラー

[POST] "/ controller/controller id/controller/new"と一致するルートはありません。

//ドクターコントローラー:

# POST /doctors 
# POST /doctors.json 

def create 
    @doctor = Doctor.new(doctor_params) 

    respond_to do |format| 
    if @doctor.save 
    format.html { redirect_to @doctor, notice: 'Doctor was successfully created.' } 
    format.json { render :show, status: :created, location: @doctor } 
    else 
    format.html { render :new } 
    format.json { render json: @doctor.errors,status::  unprocessable_entity } 
    end 
end 
end 

//ルート:

Rails.application.routes.draw do 
    resources :catergories do 
    resources :doctors 
    end 
    root 'catergories#index' 
    end 
+0

私は理解できません –

+0

あなたの質問を編集し、あなたの 'routes.rb'とその' doctors_controller.rb'ファイルを表示してください – Hizqeel

答えて

-2

ルーティングのために、レール上のあなたの基本は作品をルーティングんか、明確でなければなりません。 まず、GETとPOSTのHTTPリクエストについて知っておく必要があります。 これを見てください:http://guides.rubyonrails.org/routing.html

関連する問題