I have User, Prog, Enrollment model associated has_man through. Idea is that User adds Prog to profile and Prog can accept User's request or decline.
<% @prog.users.each do |user| %>
<%= link_to "Accept Application", controller: "/enrollments", action: "accept", method: "post", id: user.id %>/
<% end %>
enrollments_controller
def accept
@enrollment = Enrollment.find_by_user_id(params[:id])
@enrollment.status = "accepted"
@enrollment.save!
redirect_to progs_path, notice: "added"
end
I undestand that to successfuly find column with user_id and prog_id I should pass two id's to accept method, but here I'm get stack. So, could I somehow pass two ids(user.id, @prog) at once from progs/show.html.erb?