Displaying 1 result from an estimated 1 matches for "microposts_control".
2012 Jul 18
3
Undefined method error
...nder a form designed to allow a user to submit a
small message, I get an error saying, "undefined method `model_name'' for
NilClass:Class". It says the error is at line 1, which is "<%= form_for
@micropost do |f| %>". I have the following defined in
app/controllers/microposts_controller.rb:
def new
@micropost = Micropost.new
end
I would have expected this code to create a blank Micropost object that
gets passed to form_for, but that doesn''t seem to be what happened. I
attached a few files for reference.
Attachments:
http://www.ruby-forum.com/attachment/7609/...