[gettext-u-en] Problem with gettext 1.9.0 and RESTful rails app
Ernesto Jiménez Caballero
ernesto.jimenez at negonation.com
Mon May 28 09:36:18 EDT 2007
Hello,
I'm developing an XML API in a Rails app and I was experiencing a
problem with gettext 1.9.0. The XML API was working perfectly, but
from time to time I noticed persistent 500 errors from the server.
The problem came to be that when have initiated the server (no matter
if it's mongrel, or webrick) you cannot do an XML request until you
have done an HTML request, until you do the xml request yo get the
following error:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
/opt/local/lib/ruby/1.8/cgi.rb:1164:in `[]'
/opt/local/lib/ruby/gems/1.8/gems/gettext-1.9.0/lib/gettext/locale_cgi.rb:26:in
`system'
/opt/local/lib/ruby/gems/1.8/gems/gettext-1.9.0/lib/gettext/locale.rb:88:in
`system'
/opt/local/lib/ruby/gems/1.8/gems/gettext-1.9.0/lib/gettext/locale.rb:96:in
`default'
/opt/local/lib/ruby/gems/1.8/gems/gettext-1.9.0/lib/gettext/rails.rb:259:in
`render_file'
[...]
The problem is that until you do the first HTML request to the server
cgi.params is empty and cgi_["lang"] fails. I have fixed this problem
checking if params is empty in locale_cgi.rb
Patch and modified file are attached, if you need anything else contact me.
Thank you for the great gem :)
--
Ernesto Jiménez Caballero
erjica at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale_cgi.rb
Type: application/octet-stream
Size: 2579 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/gettext-users-en/attachments/20070528/6ba75df7/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale_cgi_empty_params.patch
Type: application/octet-stream
Size: 532 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/gettext-users-en/attachments/20070528/6ba75df7/attachment-0003.obj
More information about the gettext-users-en
mailing list