Scoped routes broken in global navigation #960

djonasson opened this Issue Feb 1, 2012 · 3 comments


None yet

3 participants


All my routes are scoped by language like this:

MyApp::Application.routes.draw do
  scope '(:language)' do

In my ApplicationsController.rb I have implemented the url_options method like this:

def url_options
  { :language => current_language }.merge(super)

The current language shows up fine in the action links (default_actions) but in the main menu the language is ignored causing my site to change language when navigating the menu.

Anyone else experiencing similar problems?

pranik commented Feb 2, 2012

Seems that MenuItem.generate_url(named_scope) that use Rails.application.routes.url_helpers.send(named_route) doesn't consider url_options or route scopes.
I excluded it from render menu_item.

In method build_menu_item in tabbed_navigation.rb I changed

link_to, item.url


link_to, send(item.url)

and in menu_item.rb I changed method url in

def url

I think the best solution would be to call the 'send' in a MenuItem, but I do not know how to include the "url helpers" like this:

module ActiveAdmin
  class MenuItem
    include Module::With::Access::To::ActiveAdmin::UrlHelper

    def self.generate_url(named_route)
@gregbell gregbell added a commit that referenced this issue Feb 3, 2012
@gregbell gregbell Moved the resolving of menu items into the view.
Doing this ensures that the full Rails router has been loaded including
any scoping and RackBaseURI configurations.

Fixes #101, #960
gregbell commented Feb 3, 2012

Should be fixed on master by 3e7ac40

@gregbell gregbell closed this Feb 3, 2012

Sounds great, thanks! I'll check it out as soon as I get back to the office.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment