Question

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 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!

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top