title: Ruby on Rails: undefined method `call' for nil:NilClass
body: <p>This is the line it lands on.</p>
  
  <pre><code>@object = Object.find(params[:id]) 
  
      respond_to do |format|
         if @object.update_attributes(:status=&gt;Object::PUBLISHED, :published_at =&gt; Time.now)
           format.html { redirect_to :action =&gt; :publish_detail }
           format.xml  { head :ok }
           format.json { head :ok }
    #else
    #  flash[:error] = 'There was a problem updating your object.'
    #  format.html { redirect_to :action =&gt; "publish_detail" }
    #  format.xml  { render :xml =&gt; @object.errors, :status =&gt; :unprocessable_entity }
    #  format.json { render :json =&gt; @object.errors, :status =&gt; :unprocessable_entity }
    end
  end
  </code></pre>
  
  <p>and the stack trace</p>
  
  <pre><code>/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:in `method_missing'
  /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/mime_responds.rb:175:in `respond'
  /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/mime_responds.rb:173:in `each'
  /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/mime_responds.rb:173:in `respond'
  /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/mime_responds.rb:107:in `respond_to'
  .../app/controllers/objects_controller.rb:252:in `publish'
  </code></pre>
  
  <p>why would i get an error there?</p>
  
  <p>I added </p>
  
  <pre><code>puts "||||||||||||||||||#{@object.name}"
  </code></pre>
  
  <p>and the console shows that the object isn't nil.. =\</p>
  
  <p>The log shows:</p>
  
  <pre><code>NoMethodError (undefined method `call' for nil:NilClass):
    app/controllers/objects_controller.rb:252:in `publish'
  
  Rendered rescues/_trace (26.1ms)
  Rendered rescues/_request_and_response (1.1ms)
  Rendering rescues/layout (internal_server_error)
  </code></pre>