Triggering GET method on form submit when POST method is specified

I have a form_tag to which I specify a POST method but each time I submit the form it is trying to use the GET method. Here is my form :

 <%= form_tag (refund_path(subscription), :method => "post") do %>
                  <%= hidden_field_tag :subscription_id_refund, %>
                  <%= submit_tag "Rembourser ce joueur", id: "export", class: "btn btn-warning"%>
                  <% end -%>

here is my route :

 post 'refunds/:subscription_id', to: "subscriptions#refund", as: "refund"

here is my method :

def refund
    @subscription = Subscription.find(params[:subscription_id_refund])
    if mangopay_refund
      @subscription.status == "refused"
      flash[:notice] = "Vous avez bien procéder au remboursemend de #{@subscription.user.full_name}. Celui-ci ne participe plus au tournoi"
      flash[:warning] = "Le remboursement n'a pas pu etre effectué. Merci de réessayer plus tard"

Do you know how to fix that ?

Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.