开发者

scaffold doesn't work well, the NEW method fails

I've just executed this:

rails g scaffold Photos name:string description:string

and added paperclip to that model:

rails g paperclip Photo image

and when i开发者_StackOverflow go to photos/new i get this:

undefined method `model_name' for NilClass:Class

What is the problem it may be? There is @photo = Photo.new in controller, and form_for(@photo) in new.html.erb

Thank you for ahy help!


I may be wrong but I thought that scaffolding always had to use the singular in the model name; pluralizing it leads to problems. Thus it should have been Photo, not Photos:

rails g scaffold Photo name:string description:string
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜