开发者

scaffold doesn't work well, the NEW method fails

开发者 https://www.devze.com 2023-03-29 09:28 出处:网络
I\'ve just executed this: rails g scaffold Photos name:string description:string and added paperclip to that model:

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

精彩评论

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

关注公众号