How to call a controller method from a button in rails 4

前端 未结 5 547
日久生厌
日久生厌 2020-12-15 17:30

So I feel really stupid right now, but I can\'t seem to find an answer.

So I have a method which needs to be called EXACTLY once, and since this is only the experime

5条回答
  •  一生所求
    2020-12-15 18:28

     <%= button_to 'Invite a user', new_project_invite_path, method: :get, remote: true, class: 'btn primary' %>
    

    If you don't want it to be an Ajax call then you can remove remote: true

提交回复
热议问题