Thank you for the help. Putting "@micropost = Micropost.new" in pages_controller.rb solved this error. However, I now have a new error which states "undefined method `humanize' for nil:NilClass". It says the error is at the line "<%= f.label @user.email %><br />". I defined @user = User.new in pages_controller.rb.
I am doing this a little bit differently from Michael Hartl's book. I want to be able to submit on one form the micropost content, user e-mail address and password instead of having the user logged in. Sam Serpoosh wrote in post #1069239: > when you want to create a blank instance of a model for a form's sake > like > this > scenario, you should create that blank instance in the controller's > action > which > leads to that specific view you're rendering the form in. > > As I recall in Michael Hartl's Ruby on Rails Tutorial sample application > you > rendered the _micropost_form partial in the Page's controller > home.html.erb > view which means you'll go to that view through the home action in the > PagesController and for handling this nil problem you should put that > line of code (@micropost = Micropost.new) in the home action of the > pages controller. > > Hope that helps. > Good Luck ;) > > On Thu, Jul 19, 2012 at 1:29 AM, One Two <[email protected]> wrote: > >> end >> -- >> >> > > > -- > Sam Serpoosh > Software Developer: http://masihjesus.wordpress.com > Twitter @masihjesus <http://twitter.com/masihjesus> Attachments: http://www.ruby-forum.com/attachment/7611/_micropost_form.html.erb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

