2013-04-02 87 views
1
map.resources :users, 
       :collection => {:access_history => :get }, 
       :member => {:change_access => :any } 

您好,上面的代碼是Rails 2中編寫的路由代碼的一部分。我有問題將這段代碼轉換爲Rails 3的等效代碼。如果有人能指導我解決這個問題,我會很高興。謝謝。Rails 3中的路由(從rails 2升級)

回答

0

這應該是這樣的:

resources :users do 
    collection do 
    get :access_history 
    end 

    member do 
    match :change_access 
    end 
end 

有關的Rails 3路由的詳細信息,你應該看看routing official tutorial

+0

你能在這裏加入? http://chat.stackoverflow.com/rooms/27184/ruby-conceptual –

0

較短的版本:

resources :users do 
     get 'access_history', :on => :collection 
     match 'change_access', :on => :member 
end