0

次のような非常に奇妙なエラーが発生しています。

Template is missing

Missing template /404 with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "c:/Sites/jobapp/app/views" * "C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/devise-2.1.2/app/views"

以下を除いて、他のすべてのルートが正しく機能しているように見えるため、これは奇妙です。

<%= Link_to "Add Job", new_user_job_path %>

ルートを次のように設定しています。

 JobappV2::Application.routes.draw do
  devise_for :users

  resources :newsletters

  get "pages/advertise"

  get "pages/contact"

  get "pages/about"

  get "pages/terms"

  resources :jobs do
    collection { post :search , to: 'jobs#index' }
  end


  resources :users do
     resources :jobs
  end


   root :to => 'jobs#index'


  end

したがって、を使用してユーザージョブを作成できるはずです。localhost:3000/users/1/jobs/new

Jobsコントローラーには次のものがあります。

 def new
  @user = current_user
  @job = @user.jobs.build
 end

 def create
   @user = current_user
   @job = @user.jobs.create(params[:job])
  if @job.save
    redirect_to jobs_path
  else
    render new_user_job_path(current_user.id)
  end
  end

そして、私のジョブの新しいビューでは、次のフォームメソッドを使用しています。

 <%= form_for [@user, @user.jobs.build] do |f| %>

ここで何がうまくいかないのか誰かが知っているなら、私はしばらく苦労しているので、それは本当にありがたいです:(

ありがとう!

4

1 に答える 1

1

「rendernew_user_job_path(current_user.id)」が原因です

次のようなことをします

render "edit"
于 2012-10-09T13:19:25.753 に答える