目前,当我运行rake routes
时,路线例外仍会显示。
resources :userhome, :except => [:new, :create, :edit, :update, :show, :destroy] do
collection do
post :create_invitation
end
member do
get :edit_profile_picture
post :update_profile_picture
end
end
如何使例外工作?
答案 0 :(得分:23)
消除不需要的路线的一种更简单的方法是指定:only
选项
resources :userhome, :only => [:index]
而不是
resources :userhome, :except => [:new, :create, :edit, :update, :show, :destroy]