无法找到没有ID的Studio
一切似乎都在正确的地方,但显然不是。 以下是gists描述中包含错误信息的要点。
https://gist.github.com/JRizzle88/7862465
编辑:
以下是跟踪的开头:
Started GET "/studios/new" for 127.0.0.1 at 2013-12-08 13:52:41 -0600 Processing by StudiosController#new as HTML Completed 404 Not Found in 1ms ActiveRecord::RecordNotFound - Couldn't find Studio without an ID: .... ....
将您的StudiosController中的before_filter更改为
before_action :set_studio, except: [:index, :new, :create]
将您的节目动作更改为
def show end
将您的新操作更改为
def new @studio = Studio.new end
有
before_action :set_studio
在您的StudiosController中。 params[:id]
似乎在这里是nil
,它找不到具有nil
id的Studio。 您应该only
为之前的操作添加only
或except
参数。
另一个奇怪的事情是
@studio = Studio.new(params[:id])
在StudiosController中#new。 它应该是公正的
@studio = Studio.new
不是吗?