2007/06/21

Edge Railsとruby-Gettext


先日、新しいRailsプロジェクトを作る機会がありまして、せっかくなのでRESTfulなRailsでいこうと思い、Edge Rails使うことを決意。



ですが、さっそく躓いたので、以下問題と解決です。ご参考までに。



アプリを起動するとエラーが発生し、development.logに以下のエラーが。

DISPATCHER FAILSAFE RESPONSE (has cgi) Wed Jun 20 21:18:28 +0900 2007
Status: 500 Internal Server Error
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
C:/ruby/lib/ruby/1.8/cgi.rb:1165:in `[]'
C:/ruby/lib/ruby/gems/1.8/gems/gettext-1.9.0-mswin32/lib/gettext/locale_cgi.rb:26:in `system'
C:/ruby/lib/ruby/gems/1.8/gems/gettext-1.9.0-mswin32/lib/gettext/locale.rb:88:in `system'
C:/ruby/lib/ruby/gems/1.8/gems/gettext-1.9.0-mswin32/lib/gettext/locale.rb:96:in `default'
C:/ruby/lib/ruby/gems/1.8/gems/gettext-1.9.0-mswin32/lib/gettext/rails.rb:276:in `render_file'
:
:



[gettext-u-en] Problem with gettext 1.9.0 and RESTful rails appを参考に、問題解決(ここまでくるのに、数日の間Google先生に質問攻めでした・・・)

--- /opt/local/lib/ruby/gems/1.8/gems/gettext-1.9.0/lib/gettext/locale_cgi.rb 2007-05-28 16:11:27.000000000 +0300
+++ Desktop/locale_cgi.rb 2007-05-28 16:11:49.000000000 +0300
@@ -23,7 +23,7 @@ module Locale
def system
return @@default_locale unless @@cgi
cgi_ = cgi
- if ret = cgi_["lang"] and ret.size > 0
+ if not cgi_.params.empty? and ret = cgi_["lang"] and ret.size > 0
elsif ret = cgi_.cookies["lang"][0]
elsif lang = cgi_.accept_language and lang.size > 0
num = lang.index(/;|,/)



上記問題が発生したのは、

svn co http://dev.rubyonrails.org/svn/rails/trunk rails

でとってきたEdge Railsでした。

今しがた、再度Edge Railsを取り直したら上記問題は発生せずでした・・・

rake rails:freeze:edge TAG=rel_1-2-3



なんだったんだろw

0 件のコメント: