Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `mymodel_zh_url' for #<MymodelsController:0x0000080aa205a0> #35

Open
GSI opened this issue Oct 19, 2012 · 4 comments

Comments

@GSI
Copy link

GSI commented Oct 19, 2012

It seems that under certain circumstances an inexistant URL is called.

The line in the controller looks like this:

redirect_to mymodel_url(@mymodel_instance), :status => 301

Somehow it seems, rails-translate-routes is translating that to mymodel_zh_url which is unavailable.

The full backtrace:

[GEM_ROOT]/gems/rails-translate-routes-0.1.3/lib/rails-translate-routes.rb:259:in block (3 levels) in add_untranslated_helpers_to_controllers_and_views
[PROJECT_ROOT]/app/controllers/mymodels_controller.rb:80:in redirect
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/implicit_render.rb:4:in send_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/abstract_controller/base.rb:167:in process_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/rendering.rb:10:in process_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/abstract_controller/callbacks.rb:18:in block in process_action
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:480:in _run__4034545293613287212__process_action__1314415123970547437__callbacks
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in __run_callback
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in _run_process_action_callbacks
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in run_callbacks
[GEM_ROOT]/gems/actionpack-3.2.6/lib/abstract_controller/callbacks.rb:17:in process_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/rescue.rb:29:in process_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/instrumentation.rb:30:in block in process_action
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/notifications.rb:123:in block in instrument
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in instrument
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/notifications.rb:123:in instrument
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/instrumentation.rb:29:in process_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/params_wrapper.rb:206:in process_action
[GEM_ROOT]/gems/activerecord-3.2.6/lib/active_record/railties/controller_runtime.rb:18:in process_action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/abstract_controller/base.rb:121:in process
[GEM_ROOT]/gems/actionpack-3.2.6/lib/abstract_controller/rendering.rb:45:in process
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal.rb:203:in dispatch
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal/rack_delegation.rb:14:in dispatch
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_controller/metal.rb:246:in block in action
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:73:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:73:in dispatch
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:36:in call
[GEM_ROOT]/gems/journey-1.0.3/lib/journey/router.rb:68:in block in call
[GEM_ROOT]/gems/journey-1.0.3/lib/journey/router.rb:56:in each
[GEM_ROOT]/gems/journey-1.0.3/lib/journey/router.rb:56:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:600:in call
[GEM_ROOT]/bundler/gems/rack-piwik-4d426315c034/lib/rack/piwik.rb:18:in _call
[GEM_ROOT]/bundler/gems/rack-piwik-4d426315c034/lib/rack/piwik.rb:15:in call
[GEM_ROOT]/gems/warden-1.2.1/lib/warden/manager.rb:35:in block in call
[GEM_ROOT]/gems/warden-1.2.1/lib/warden/manager.rb:34:in catch
[GEM_ROOT]/gems/warden-1.2.1/lib/warden/manager.rb:34:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/best_standards_support.rb:17:in call
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/etag.rb:23:in call
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/head.rb:14:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/params_parser.rb:21:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/flash.rb:242:in call
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in context
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/cookies.rb:338:in call
[GEM_ROOT]/gems/activerecord-3.2.6/lib/active_record/query_cache.rb:64:in call
[GEM_ROOT]/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/callbacks.rb:28:in block in call
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in _run__3147508345656361752__call__1650080518533853104__callbacks
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in __run_callback
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in _run_call_callbacks
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in run_callbacks
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/callbacks.rb:27:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/remote_ip.rb:31:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:16:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/show_exceptions.rb:56:in call
[GEM_ROOT]/gems/railties-3.2.6/lib/rails/rack/logger.rb:26:in call_app
[GEM_ROOT]/gems/railties-3.2.6/lib/rails/rack/logger.rb:16:in call
[GEM_ROOT]/gems/actionpack-3.2.6/lib/action_dispatch/middleware/request_id.rb:22:in call
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in call
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/runtime.rb:17:in call
[GEM_ROOT]/gems/activesupport-3.2.6/lib/active_support/cache/strategy/local_cache.rb:72:in call
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/lock.rb:15:in call
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in fetch
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in lookup
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in call!
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call
[GEM_ROOT]/gems/railties-3.2.6/lib/rails/engine.rb:479:in call
[GEM_ROOT]/gems/railties-3.2.6/lib/rails/application.rb:220:in call
[GEM_ROOT]/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in method_missing
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/request_handler.rb:96:in process_request
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:513:in accept_and_process_next_request
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:274:in main_loop
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:206:in start_request_handler
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:171:in block in handle_spawn_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb:479:in safe_fork
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:166:in handle_spawn_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in server_main_loop
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in start_synchronously
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:180:in start
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:129:in start
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:253:in block (2 levels) in spawn_rack_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:132:in lookup_or_add
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:246:in block in spawn_rack_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:82:in block in synchronize
::in 
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:244:in spawn_rack_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:137:in spawn_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:275:in handle_spawn_application
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in server_main_loop
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in start_synchronously
/s/usr-local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/helper-scripts/passenger-spawn-server:99:in <main>
@guiocavalcanti
Copy link

same problem here

@guiocavalcanti
Copy link

@GSI, did you manage to solve it?

@GSI
Copy link
Author

GSI commented Nov 20, 2012

@guiocavalcanti I was yet unable to find the time to look into it, but I intend to investigate the gem in December. Anything you can bring up in the meantime will be of help!

@GSI
Copy link
Author

GSI commented Feb 8, 2013

Workaround: In my set_locale before_filter, I ensure that `I18n.locale' is only set to locales that are actually defined in the routes.yml.

However, it appears more logical to have rails-translate-routes work nicely with any I18n.locale - even if translations for the URL path are unavailable.

@francesc can you help us to further investigate that issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants