이것은 그것이 착륙하는 라인입니다. 루비 온 레일즈 (Ruby on Rails) : 정의되지 않은 메소드`call 'for nil : NilClass
@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)
전체 respond_to 차단을 게시 할 수 있습니까? –
오류와 더 많은 코드에서 스택 추적을 게시 할 수 있습니까? –
=) 모든 것을 스택 트레이스 – NullVoxPopuli