2013-07-31 50 views
1

我有,我認爲會一直某處回答了一個問題,但我不能找到它,所以我有這樣的Rails的康康舞load_resource嵌套路線

resources :users, only: [:show, :edit, :update] do                                    
    get :resend_invitation                              
end 

我的路由,這樣當然:resend_invitation路線是這樣的/users/:user_id/resend_invitation

看起來像Cancan只能使用:id參數加載資源。我無法在文檔中找到如何指定以包含:user_id參數。我只是想自動加載我的資源爲我的嵌套路線以及。

如果有人有任何見解,我將非常感激。

感謝

編輯度:

我的最終目標是,我想@user在我嵌套的路線

def resend_invitation 
    # @user = User.find(params[:user_id] done by cancan 
    @user.something 
end 
+0

我不明白你想要什麼,想要可@user對象可用的嗎? –

+0

我更新了問題,以便更清楚地表示感謝! – timanema

回答

相關問題