lundi 14 octobre 2019

how to "get" with Ruby on rails form

I try get 2 players from a list that i created, all I need is to get all the informations about those 2 players (name, descrption etc...) and once i have selected both, I need to be redirected to /fight path. My form doesnt work and I don't understand why. Could someone help me please ?

Here is my view :

<%= form_tag ("/fight", :method => "get") do %>
  <%= label_tag :player1 %>
  <%= select_field :character, @characters.collect{|u| [u.name, u.id]} %>
  <%= label_tag :playe2 %>
  <%= select_field :character, @characters.collect{|u| [u.name, u.id]} %>
  <%= form.submit 'Fight' %>
<% end %>

My pages_controller

def index 
  @characters = Character.all
end

And my routes

get 'fight' => 'pages#index'

Aucun commentaire:

Enregistrer un commentaire