2016-10-25 6 views
0

꽤 바닐라 인 초대 컨트롤러 만들었습니다params를 내 devise_invitable 컨트롤러에 전달하는 방법은 무엇입니까?

class InvitationsController < Devise::InvitationsController 
    def new 
    binding.pry 
    end 
end 

을 그리고 그 요청과 같이 트리거 링크 생성 :

<%= link_to "Invite #{@profile.name}", new_user_invitation_path(email: @profile.email), class: "btn btn-xs btn-primary" %> 

내가 던져지는 것을 때 데 문제를 그 행동에 놀래켜, 그것은 나를 나타내지 않는다 email 매개 변수.

> params 
=> <ActionController::Parameters {"controller"=>"invitations", "action"=>"new"} permitted: false> 

어떻게 그 InvitationsControler#New 행동과 PARAMS을 보낼 수 있습니까?

답변

0

new_user_invitation_path은 새 양식을 생성하는 새로운 초대 개체에 대한 GET 요청에 해당합니다.

이 솔루션은 단순히 다음 다른 컨트롤러에서 다른 동작을 만들 수 있도록 같은 method: :post 그것을 호출하는 것입니다 :

매력처럼 작동
<%= link_to "Invite #{@profile.name}", invite_path(@profile), method: :post, data: { confirm: "Are you SURE you are ready to invite #{@profile.name}?"}, class: "btn btn-xs btn-primary" %> 

.

관련 문제