Это строка, на которую он попадает.
@object = Object.find(params[:id])
respond_to do |format|
if @object.update_attributes(:status=>Object::PUBLISHED, :published_at => Time.now)
format.html { redirect_to :action => :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 => "publish_detail" }
# format.xml { render :xml => @object.errors, :status => :unprocessable_entity }
# format.json { render :json => @object.errors, :status => :unprocessable_entity }
end
end
и трассировка стека
/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'
почему я могу получить ошибку там?
Я добавил
puts "||||||||||||||||||#{@object.name}"
и консоль показывает, что объект не ноль .. = \
Журнал показывает:
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)