我曾經遇到過一個奇怪的錯誤消息,當我嘗試加載我的測試生產服務器上我的網站的某些網頁(大多數頁面,實際上)。奇怪::的ActionView ::模板中的錯誤生產,500內部服務器錯誤
Started GET "/students" for 10.0.0.68 at Mon Sep 17 12:53:16 +0100 2012
Processing by StudentsController#index as HTML
Rendered shared/_alerts.html.erb (0.7ms)
Rendered students/_student_search.html.erb (0.0ms)
Rendered students/index.html.erb within layouts/application (17.8ms)
Completed 500 Internal Server Error in 92ms
ActionView::Template::Error (syntax error on line 4, col 586: ` state: ["北海道","青森県","巖手県","宮城県","秋田県","山形県","福島県","茨城県","栃木県","羣馬県","埼玉県","千葉県","東京都","神奈川県","新潟県","富山県","石川県","福井県","山梨県","長野県","岐阜県","靜岡県","愛知県","三重県","滋賀県","京都府","大阪府","兵庫県","奈良県","和歌山県","鳥取県","島根県","岡山県","広島県","山口県","徳島県","香川県","愛媛県","高知県","福岡県","佐賀県","長崎県","熊本県","大分県","宮崎県","鹿児島県","沖縄県"]'):
59: <% end %>
60:
61: <div class="sidebar_item">
62: <h2>Filter By <%= t(:class) %></h2>
63: <div class="content">
64:
65: <% if Klass.where(:tutor_group => false).count > 0 %>
app/views/students/index.html.erb:62:in `_app_views_students_index_html_erb___542210558__648905548'
app/views/students/index.html.erb:35:in `_app_views_students_index_html_erb___542210558__648905548'
無論網頁上所發生的錯誤消息始終是相同的(同一行和col號),但文件名是不同的,引用的代碼也發生了變化。據我所知,或者可以看到我的代碼中沒有任何這些日文字符。這似乎是一些編碼問題或某事,但我真的不知道,我不知道從哪裏開始調試它。
我ENV:
[email protected]:~$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
[email protected]:~$ rails -v
Rails 3.2.0
[email protected]:~$ gem -v
1.8.15
[email protected]:~$ /opt/nginx/sbin/nginx -V
nginx version: nginx/1.2.3
built by gcc 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt=-Wno-error --with-pcre=/tmp/root-passenger-16778/pcre-8.31 --add-module=/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/nginx
[email protected]:~$ passenger -v
Phusion Passenger version 3.0.17
Ubuntu是11.04。
更新: OK,我將問題範圍縮小下來一些。找出它與方法調用t(:class),這是一個用於轉換的rails幫助器方法有關,並且在我的視圖中出現了很多(我是這個應用程序的新手,所以仍然讓我的頭腦發現它是如何書面)。根據當前的兩個區域文件判斷,這意味着根據區域設置返回「學校」或「班級」。但是,我仍然不知道爲什麼它會導致此錯誤。
對這個問題的答案http://stackoverflow.com/questions/12449977/heroku-run-dbmigrate-fail -as-rake-aborted應該有所幫助: http://stackoverflow.com/a/12451678 –
如果您以某種方式再次發佈它作爲答案,我會接受它。 –