jeudi 28 mai 2015

Ruby submit_tag button not doing anything

I want to create a form_tag in my index view to accept an id which gets passed to my populateOne method. The view has been updated properly, both the number_field_tag in the form and the submit_tag are there, but when I press the button on my server, nothing happens!

Here is my view:

<%= form_tag('/affinities/populateOne/1', method: :put) %>
<%= number_field_tag(1) %>
<%= submit_tag 'Populate One' %><br>

Here are my routes:

get 'affinities/populateOne/:id' => 'affinities#populateOne', :as => 'populateOne_affinity'

My populateOne method is long, so here is the relevant part:

def populateOne
    userA = User.find(params[:id])
    ...
end

What could be the problem? All help is very much appreciated! Thanks!!!

Aucun commentaire:

Enregistrer un commentaire