私は友情を作ろうとしていて、acceptというカスタムアクションを作成しました。しかし、私はそれに到達することはできません。それを呼び出すたびに、アクションショーが見つかりませんでした。
ここに私のroute.rbファイルがあります
resources :friendships do
collection do
delete 'cancel'
get 'accept'
end
end
ここで私はそれをどのように呼ぶか
<%= link_to 'Accept', accept_friendships_path(:friend_id => f) %>
accept_friendshipsは、rakeroutesコマンドから取得されました。そして、ここで私は私の受け入れコントローラーをどのように定義するか
#Accept friendships
def accept
if @customer.requested_friends.include?(@friend)
Friendship.accept(@customer, @friend)
flash[:notice] = "Friendship Accepted"
else
flash[:notice] = "No Friendship request"
end
redirect_to root_url
end
ここでエラー
Unknown action
The action 'show' could not be found for FriendshipsController