2011-04-17 145 views
1

我有一個問題,我有像這樣的路線管理員子站點設置:Rails 3的路由問題

constraints :subdomain => 'admin' do 
scope :module => "admin" do 

    match 'articles/:id/', :to => 'articles#show' 

    resources :articles, :events do 
    collection do 
     post :update_attribute_on_the_spot 
    end 
    end 

    root :to => "dashboard#index" 

end 
end 

然後在主網站的文章,我有:

resources :articles, :events, :george 
    match '/:year/:month/:day/:slug', :to => 'articles#show', :as => "article", :constraints => {:year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/ } 
    match '/event/:year/:month/:day/:slug', :to => 'events#show', :as => "event", :constraints => {:year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/ } 

我想知道如何確保在管理子域路由生效時不使用主站點路由,截至目前,當將管理部分文章顯示映射到主站點路由時,因此管理路由將不起作用,除非該路線被刪除。

如果任何人都可以告訴我圍繞這個問題的最好方法,那就太好了。

謝謝!

回答

0

我不知道聲明的東西:如將覆蓋任何其他途徑如此簡單:

match '/:year/:month/:day/:slug', :to => 'articles#show', :constraints => {:year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/ } 

固定的一切!