vendredi 1 décembre 2017

pass data from html to controller ruby on rails

Hi i want to send the selected object to a controller method but I dont know how. this is the select list with the vaules in it

HTML

%= form_tag '/wendy' do %>
  <%= select_tag :'buenwendy', options_from_collection_for_select(@cursitos, 'id', 'name') %>
  <%= submit_tag 'buscar', class: 'btn btn-success' %>
<% end %>

ROUTE

post 'wendy', to: 'blog#wendy  

CONTROLLER

def wendy
  gg= params[:buenwendy]
  flash[:success]= gg
  redirect_to root_path
end   

Aucun commentaire:

Enregistrer un commentaire