在Rails 2.3.8中处理本地化名称间隔路由的正确方法是什么?

我正在本地化我的应用程序,并且正在努力解决如何处理应用程序特定部分的路由。 最初我的路线看起来像这样:
    map.namespace :admin do |admin|
      admin.resources :people, :member => {:confirm_destroy => :get}, :collection => {:follow => :post, :sync_friends => :get, :upload => :post, :import => :get, :recommendations => :get, :mark_recommendations => :post, :batch_create => :post}
      admin.resources :jobs, :collection => {:remove => :post}
      admin.resources :users, :member => {:confirm_destroy => :get}
      admin.resources :sites, :member => {:update_design => :post, :design => :get, :update_links => :post, :links => :get, :content => :get, :update_content => :post, :add_admin => :post, :remove_admin => :post, :set_system_account => :get, :confirm_system_account => :get}, :collection => {:remove => :post, :upload => :post}
      admin.resources :subscriptions, :member => { :charge => :post, :migrate_plan => :post, :update_components => :post }
      admin.resources :accounts, :collection => {:remove => :post}
      admin.resources :subscription_plans, :as => 'plans'
      admin.resources :subscription_discounts, :as => 'discounts'
      admin.resources :twitter_lists, :collection => {:auto_generate_twitter_list => :post}
    end
从我在其他路线上成功完成的工作我需要补充:
:path_prefix => '/:locale/'
到这些路线。 我遇到的唯一例子看起来像这样:
  map.with_options(:path_prefix => '/:locale/admin') do |locale|
    locale.namespace :admin do |admin|
      admin.resources :people, :member => {:confirm_destroy => :get}, :collection => {:follow => :post, :sync_friends => :get, :upload => :post, :import => :get, :recommendations => :get, :mark_recommendations => :post, :batch_create => :post}
      admin.resources :subscriptions, :member => { :charge => :post, :migrate_plan => :post, :update_components => :post }
      admin.resources :accounts, :collection => {:remove => :post}
      etc etc etc
    end
  end
这实际上似乎适用于路由,但是,它正在搞砸我生成的一些URL。 例如,之前我有类似
= link_to(t('subscription'), edit_admin_subscription_path(subscription_id)
的东西,它完美地工作...在上面的更改后,这个url不再正确生成,给出以下错误: Admin / base #index中的ActionController :: RoutingError 显示第13行引发的app / views / admin / shared / _menu.html.haml: edit_admin_subscription_url无法从{:action =>“edit”生成,:controller =>“admin / subscriptions”,:locale => BSON :: ObjectId('4d0ecb6587adddc91c000014')},期望:{:controller =>“admin / subscriptions “,:action =>”edit“},diff:{:locale => BSON :: ObjectId('4d0ecb6587adddc91c000014')} 我真诚地感谢任何人都可以找到处理此类事物的正确方法的任何见解和/或为什么这个网址不再生成。谢谢!     
已邀请:
因此,在添加本地化之后,我需要更具体地使用传递给URL帮助程序的参数:
= link_to(t('subscription'), edit_admin_subscription_path(:id => subscription_id)
工作正常。 仍然不确定是否确定
  map.with_options(:path_prefix => '/:locale/admin') do |locale|
    locale.namespace :admin do |admin|
是最好的方法,但至少它现在正在工作。     

要回复问题请先登录注册