Creating a variable via the form rails -


value variables written in variables @first_city, @last_city, @date_trip of controller. without creating object in database. pass values of these variables page. possible or not?

<%= form_for(@orders) |f| %>         <p>Выберите маршрут</p>           <%= f.select(:first_city, @city_select, :value => :first_city, prompt: "Откуда")   %>          <%= f.select(:last_city, @city_select, prompt: "Куда")   %>          <%= f.text_field :date_trip  %><br>          <%= f.submit "Дальше", class: "btn" %>     <% end %> 

yes.

however if state

form_for(@orders) 

it automatically assume creating order.

however can

    form_for @order, :url => {:action => "action"} 

create own action , access values trough

 order_params[] 

and can whatever want data

hope helped


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -