当我在我的 Jobs 表单上按 new 时看到一个错误,它在我的 JobsController 中找不到“create”。
Unknown action
The action 'create' could not be found for JobsController
这是我的控制器:
class JobsController < ApplicationController
private
def load_clients
@clients = collection_select :client, :client_id
end
def index
@job = Job.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @job }
end
end
def create
@job = Job.new(params[:job])
respond_to do |format|
if @job.save
format.html { redirect_to @job, notice: 'Job was successfully created.' }
format.json { render json: @job, status: :created, location: @job }
else
format.html { render action: "new" }
format.json { render json: @job.errors, status: :unprocessable_entity }
end
end
end
def show
@job = Job.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @job }
end
end
end
如你看到的。它显然在那里。为什么 Rails 看不到它?