title: Why am I getting undefined method `model_name' for NilClass:Class?
body: <p>I get this when I visit a user's profile page. so localhost:3000/users/1 for example...</p>
  
  <p>I get it here in line 1</p>
  
  <pre><code>1: &lt;%= form_for(@micropost) do |f| %&gt;
  2:   &lt;%= render 'shared/error_messages', object: f.object %&gt;
  3:   &lt;div class="field no-indent"&gt;
  4:     &lt;%= f.text_area :content, placeholder: "What's something else you want to buy?" %&gt;
  </code></pre>
  
  <p>so then I have two micropost forms one is here </p>
  
  <pre><code>&lt;%= form_for(@micropost, :html =&gt; { :id =&gt; "sale" }) do |f| %&gt;
    &lt;%= render 'shared/error_messages', object: f.object %&gt;
    &lt;div class="field no-indent"&gt;
      &lt;%= f.text_area :content, placeholder: "What's something else you want to buy?" %&gt;
      &lt;%= hidden_field_tag 'micropost[kind]', "sale" %&gt;
    &lt;/div&gt;
    &lt;%= f.submit "Post", class: "btn btn-large btn-primary" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>and another one is here </p>
  
  <pre><code>&lt;%= form_for(@micropost) do |f| %&gt;
    &lt;%= render 'shared/error_messages', object: f.object %&gt;
    &lt;div class="field no-indent"&gt;
      &lt;%= f.text_area :content, placeholder: "What's something else you want to buy?" %&gt;
      &lt;%= hidden_field_tag 'micropost[kind]', "purchase" %&gt;
    &lt;/div&gt;
    &lt;%= f.submit "Post", class: "btn btn-large btn-primary" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Here is my routes. </p>
  
  <pre><code>SampleApp::Application.routes.draw do
    resources :users do
      resources :comments
      member do
        get :following, :followers
      end
    end
    resources :sessions, only: [:new, :create, :destroy]
    resources :microposts, only: [:create, :destroy] do
      resources :comments
      resources :kind
    end
    resources :relationships, only: [:create, :destroy]
  
    root to: 'static_pages#home'
  
    match '/signup',  to: 'users#new'
    match '/signin',  to: 'sessions#new'
    match '/signout', to: 'sessions#destroy', via: :delete
  
    match '/help',    to: 'static_pages#help'
    match '/about',   to: 'static_pages#about'
    match '/contact', to: 'static_pages#contact'
  </code></pre>
  
  <p>and here is the code for the page itself (users show)</p>
  
  <pre><code>      &lt;section&gt;
          &lt;%= render 'shared/user_info' %&gt;
        &lt;/section&gt;
  
        &lt;section&gt;
          &lt;div id= "purchases"&gt;
            &lt;%= render 'shared/micropost_form_purchase' %&gt;
          &lt;/div&gt;
          &lt;div id="sales"&gt;
            &lt;%= render 'shared/micropost_form_sale' %&gt;
          &lt;/div&gt;
        &lt;/section&gt;
  
  
  &lt;% provide(:title, @user.name) %&gt;
  &lt;div class="row"&gt;
    &lt;aside class="span4"&gt;
      &lt;section&gt;
        &lt;h1&gt;
          &lt;%= gravatar_for @user %&gt;
          &lt;%= @user.name %&gt;
        &lt;/h1&gt;
      &lt;/section&gt;
    &lt;/aside&gt;
    &lt;div class="span8"&gt;
  
      &lt;% if @user.microposts.any? %&gt;
        &lt;h3&gt;Purchases I am interested in (&lt;%= @user.microposts.count %&gt;)&lt;/h3&gt;
        &lt;ol class="microposts"&gt;
          &lt;%= render @microposts %&gt;
        &lt;/ol&gt;
        &lt;%= will_paginate @microposts %&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>also I dont understand how you can pass an empty object into form for? Isn't the whole point of the form to create the object? </p>