i18n icon indicating copy to clipboard operation
i18n copied to clipboard

ArgumentError (wrong number of arguments (0 for 1)) in fallbacks.rb 57 in 'index' on Heroku

Open ncri opened this issue 16 years ago • 12 comments

Hi,

this is a very specific thing it seems, but I'can't figure out what's going wrong. I'm using the 0.3.5 gem together with globalize 2 on heroku (rails 2.3.5). Locally all works fine, but on heroku I get an error, which seems to be related to authlogic, but finally occurs in the I18n gem. I tried to patch the gem, but wasn't able to freeze it. Rake gems:freeze, simply ignores the I18n gem - that's another issue.

Oh, I forgot to say I'm using the I18n gem to have fallbacks functionality, so I added these lines to my environment.rb:

require "i18n/backend/fallbacks"
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)

Anyway, here is the trace from the heroku log:

 ArgumentError (wrong number of arguments (0 for 1)):
 /home/slugs/142192_6a390c5_274e/mnt/.gems/gems/i18n-0.3.5/lib/i18n/backend/fallbacks.rb:57:in `index'
 /home/slugs/142192_6a390c5_274e/mnt/.gems/gems/i18n-0.3.5/lib/i18n/backend/fallbacks.rb:57:in `extract_string_default!'
 /home/slugs/142192_6a390c5_274e/mnt/.gems/gems/i18n-0.3.5/lib/i18n/backend/fallbacks.rb:41:in `translate'
 /home/slugs/142192_6a390c5_274e/mnt/.gems/gems/i18n-0.3.5/lib/i18n.rb:208:in `translate'
 authlogic (2.1.3) lib/authlogic/i18n/translator.rb:8:in `translate'
 authlogic (2.1.3) lib/authlogic/i18n.rb:78:in `t'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/email.rb:68:in `validates_format_of_email_field_options'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/email.rb:102:in `included'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/email.rb:99:in `class_eval'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/email.rb:99:in `included'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/base.rb:34:in `include'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/base.rb:34:in `acts_as_authentic'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/base.rb:34:in `each'
 authlogic (2.1.3) lib/authlogic/acts_as_authentic/base.rb:34:in `acts_as_authentic'
 vendor/plugins/rails_base_app/app/models/user.rb:22
 /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
 authlogic (2.1.3) lib/authlogic/session/klass.rb:33:in `klass'
 authlogic (2.1.3) lib/authlogic/session/password.rb:90:in `login_field'
 authlogic (2.1.3) lib/authlogic/session/password.rb:213:in `login_field'
 authlogic (2.1.3) lib/authlogic/session/password.rb:118:in `initialize'
 authlogic (2.1.3) lib/authlogic/session/activation.rb:48:in `initialize'
 authlogic (2.1.3) lib/authlogic/session/klass.rb:64:in `initialize'
 authlogic (2.1.3) lib/authlogic/session/scopes.rb:79:in `initialize'
 authlogic (2.1.3) lib/authlogic/session/persistence.rb:37:in `new'
 authlogic (2.1.3) lib/authlogic/session/persistence.rb:37:in `find'
 haml (2.2.3) rails/./lib/sass/plugin/rails.rb:19:in `process'
 /home/heroku_rack/lib/static_assets.rb:9:in `call'
 /home/heroku_rack/lib/last_access.rb:25:in `call'
 /home/heroku_rack/lib/date_header.rb:14:in `call'
 thin (1.0.1) lib/thin/connection.rb:80:in `pre_process'
 thin (1.0.1) lib/thin/connection.rb:78:in `catch'
 thin (1.0.1) lib/thin/connection.rb:78:in `pre_process'
 thin (1.0.1) lib/thin/connection.rb:57:in `process'
 thin (1.0.1) lib/thin/connection.rb:42:in `receive_data'
 eventmachine (0.12.6) lib/eventmachine.rb:240:in `run_machine'
 eventmachine (0.12.6) lib/eventmachine.rb:240:in `run'
 thin (1.0.1) lib/thin/backends/base.rb:57:in `start'
 thin (1.0.1) lib/thin/server.rb:150:in `start'
 thin (1.0.1) lib/thin/controllers/controller.rb:80:in `start'
 thin (1.0.1) lib/thin/runner.rb:173:in `send'
 thin (1.0.1) lib/thin/runner.rb:173:in `run_command'
 thin (1.0.1) lib/thin/runner.rb:139:in `run!'
 thin (1.0.1) bin/thin:6
/usr/local/bin/thin:20:in `load'
/usr/local/bin/thin:20

Any help is greatly appreciated!

Nico

ncri avatar Mar 07 '10 22:03 ncri

Any help on this?

ncri avatar Mar 20 '10 08:03 ncri

I had the same problem - not on Heroku, but on a standard Linux virtual machine. It worked fine on my local OSX dev environment, but blew up when deploying. In my environment I had this:

require "i18n/backend/fallbacks"
I18n.default_locale = :en
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)

I also tried using the string 'en' instead of a symbol, same problem.

Here's the backtrace:

$ RAILS_ENV=production rake db:migrate --trace 
(in /sites/website.example.com/releases/20100320164402)
rake aborted!
wrong number of arguments (0 for 1)
/usr/local/lib/ruby/gems/1.8/gems/i18n-0.3.5/lib/i18n/backend/fallbacks.rb:57:in `index'
/usr/local/lib/ruby/gems/1.8/gems/i18n-0.3.5/lib/i18n/backend/fallbacks.rb:57:in `extract_string_default!'
/usr/local/lib/ruby/gems/1.8/gems/i18n-0.3.5/lib/i18n/backend/fallbacks.rb:41:in `translate'
/usr/local/lib/ruby/gems/1.8/gems/i18n-0.3.5/lib/i18n.rb:208:in `t'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:134:in `translate_static_segment'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:153:in `locale_segments'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:151:in `each'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:151:in `locale_segments'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:167:in `translate_route_by_locale'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:189:in `translate_route'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:188:in `each'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:188:in `translate_route'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:94:in `translate_current_routes'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:90:in `each'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:90:in `translate_current_routes'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/lib/translate_routes.rb:40:in `i18n'
/sites/website.example.com/releases/20100320164402/config/routes.rb:22
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load_without_new_constant_marking'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:286:in `load_routes!'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:286:in `each'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:286:in `load_routes!'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:266:in `reload!'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:537:in `initialize_routing'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:188:in `process'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/sites/website.example.com/releases/20100320164402/vendor/plugins/refinery/lib/refinery/initializer.rb:47:in `run'
/sites/website.example.com/releases/20100320164402/config/application.rb:16
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/sites/website.example.com/releases/20100320164402/config/environment.rb:16
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/sites/website.example.com/releases/20100320164402/vendor/plugins/translate_routes/tasks/translate_routes_tasks.rake:2
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load_without_new_constant_marking'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/rails.rb:7
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/rails.rb:7:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/rails.rb:7
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/sites/website.example.com/releases/20100320164402/Rakefile:16
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

Fortunately I was able to turn off fallbacks totally and work around the production problem by re-coding things a bit. I would like to use them however! Anybody find a workaround?

somebox avatar Mar 20 '10 17:03 somebox

Any updates on this?

ncri avatar Apr 29 '10 06:04 ncri

This problem still exists in the latest gem (0.4.0.beta)? Can you please try to isolate it in a simple ruby script?

josevalim avatar May 02 '10 10:05 josevalim

How to install the beta gem? Yes, I will try to isolate the problem...

ncri avatar May 02 '10 12:05 ncri

gem install i18n --version=0.4.0.beta

josevalim avatar May 02 '10 12:05 josevalim

Ah, thanks! I need to first wait for the Heroku guys to update ruby gems... They still use Version 1.3.5... I sent them a request.

ncri avatar May 02 '10 13:05 ncri

Are you using which ruby version? If you are using Ruby 1.8.6, it was indeed a bug and should be fixed even on I18n 0.3.7.

josevalim avatar May 03 '10 09:05 josevalim

Ah okay, sounds great! But also the 0.3.7 gem requires ruby gems >= 1.3.6. So i can only test when ruby gems was upgradet on Heroku. I never had the problem locally on my machine .

ncri avatar May 03 '10 10:05 ncri

Try to change the heroku stack to bamboo-1.8.7 ... it already uses RubyGems 1.3.6 so you can easily use i18n gem version 0.3.7 ..

More information here: http://docs.heroku.com/stack

hotsen avatar May 05 '10 16:05 hotsen

Thanks, I tried that already, but I can't get it running so far due to an RMagick issue. I can't use the same ImageMagick/RMagick combo that was on the aspen stack on bamboo as bamboo has another ImageMagick version installed which requires a different rmagick gem to be installed.

ncri avatar May 05 '10 16:05 ncri

Thanks, this works now!

ncri avatar May 13 '10 09:05 ncri