0
我得到以下點擊該鏈接設計和用戶路由Confilect
<%= link_to "(#{User.count_friend_requests(current_user)}) Friends Requests", :controller => "users", :action=>"friend_requests"%>
我得到這個錯誤
ActionController::UrlGenerationError in Devise::Registrations#edit
No route matches {:action=>"friend_requests", :controller=>"devise/users", :format=>"1"}
路線
devise_for :users, :path_prefix => 'my'
resources :users, :only => [:friend_requests] do
get "friend_requests", :on => :collection
end
users_controller
def friend_requests
@frnds = User.find_friend_requests(current_user)
end
你能提供一個「rake routes」輸出嗎?我敢打賭,devise_for創建像設計/用戶和資源的路線:用戶創建像localhost:3000/users/friend_requests的路線 – AKovtunov
請參閱編輯,你是對的,我找不到解決方案。 –
你可以嘗試命名路線嗎? 'friend_requests_users_path'? – Leito