2010-04-27 29 views
5

Lỗi lạ trong tệp diagnostics.erb về _set_controller_content_type.phương thức chưa xác định `content_type 'cho nil: NilClass

Vui lòng trợ giúp.

NoMethodError in Timelines#public_timeline 

Showing /opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/templates/rescues/diagnostics.erb where line # raised: 

undefined method `content_type' for nil:NilClass 
Extracted source (around line #): 

RAILS_ROOT: /Volumes/DATA/Source/Rails/tvider 

Application Trace | Framework Trace | Full Trace 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/base.rb:331:in `_set_controller_content_type' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/renderable.rb:32:in `block in render' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/base.rb:306:in `with_template' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/renderable.rb:30:in `render' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/template.rb:205:in `render_template' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/base.rb:265:in `render' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:134:in `rescue_action_locally' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:152:in `rescue_action_without_handler' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:74:in `rescue_action' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:162:in `rescue in perform_action_with_rescue' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action_with_flash' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process_with_filters' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call' 
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call' 
Request 

Parameters: 

None 
Show session dump 

Response 

Headers: 

{"Cache-Control"=>"no-cache", 
"Content-Type"=>""} 
+0

Hiển thị mã yor, trả lại lỗi này – fl00r

Trả lời

2

hành động bạn đang cố gắng gọi trong khiển?

kiểm tra action_name trong bộ điều khiển!

9

Tôi không biết đây có phải là nguyên nhân gây ra lỗi của bạn hay không. Nhưng khi tôi nhận được lỗi này, đó là vì tôi đã không định nghĩa một hành động "phản hồi" trong bộ điều khiển của mình. Đổi tên hành động, và tất cả đều tốt.

+0

Có, mẹo đó đã thực hiện! Tôi cũng đã có một vấn đề tương tự (xác định một hành động phản ứng trong bộ điều khiển của tôi). Đổi tên đó và bây giờ hoạt động như một say mê. Cảm ơn bạn đã đăng bài này. – Neovibrant

+6

Tôi gặp lỗi này vì tôi đã xác định hành động 'yêu cầu'. Cảm ơn – you786

+0

Bạn có ý nghĩa gì khi xác định "hành động phản hồi" trong bộ điều khiển của mình? – bcackerman

Các vấn đề liên quan