検証エラーが更新されるとルーティングの問題が発生します。
私は検証エラーを修正するときレールでのルーティングエラー4
Started POST **"/employees"** for 127.0.0.1 at 2016-07-06 14:07:23 +0530 Processing by EmployeesController#create as HTML
がどのように私は、/ new.Thisが発生したルートの従業員を取得することができ、私は
Started POST **"/employees/new"** for 127.0.0.1 at 2016-07-06 14:07:23 +0530 Processing by EmployeesController#create as HTML
をしたいが、私は得ます。これが解決した場合は
resources :employees
get 'new' => 'employee#new'
get 'create' => 'employee#create'
get 'index' => 'employee#index'
と_controller /メソッドを作成し、
if @employee.save
respond_to do |format|
format.html {redirect_to action: "index"}
end
else
render 'new'
end
、データは保存しないが、それはROLLBACKになります。
については
resources :employees, only: [:show, :edit, :update, :index]
、私はコードで私の質問を更新 –
_controller.rb' '私にあなたの' routes.rb'とあなたのファイルを表示してください。 – Prabha
あなたが得ている投稿は正しいです。保存できない場合は 'new'をレンダリングしますが、あらかじめそのポストを保持します。詳細については、リクエスト+レスポンスのログエントリ全体を投稿してください。 – Matt