title: Why is my Rails instance variable nil in my view?
body: <p>I am stuck on someothing probably incredibly stupid, but I can't find my problem.  I'm using Rails 3.0.3, and ruby 1.9.2 on a ubuntu machine.</p>
  
  <p>I am trying to just set an instance variable in my controller, and use it to create a form on a new view template, yet it is coming up nil in my view.   I know that instance variables set in the controller are supposed to be copied to the view, but here its set to nil.  Can anyone see what I'm doing wrong?  Here is my error message:</p>
  
  <pre><code>NoMethodError in Urls#new 
  
  undefined method `model_name' for NilClass:Class
  
  Extracted source (around line #1): 
  
  1: &lt;%= form_for @url do |f| %&gt;
  2:    &lt;%= f.submit %&gt;
  3: &lt;% end %&gt;
  </code></pre>
  
  <p>app/controllers/urls_controller.rb</p>
  
  <pre><code>class UrlsController &lt; ApplicationController
    def new
      @url = Url.new
    end
  end
  </code></pre>
  
  <p>app/views/urls/new.html.erb</p>
  
  <pre><code>&lt;%= form_for @url do |f| %&gt;
     &lt;%= f.submit %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>app/models/url.rb </p>
  
  <pre><code># == Schema Information
  # Schema version: 20110122002326
  #
  # Table name: urls
  #
  #  id         :integer         not null, primary key
  #  long_url   :text
  #  short_url  :string(255)
  #  created_at :datetime
  #  updated_at :datetime
  #
  
  class Url &lt; ActiveRecord::Base
  end
  </code></pre>
  
  <p>app/controllers/application_controller.rb</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    protect_from_forgery
  end
  </code></pre>