Reputation: 1658
I want to take value from view and pass it to my controller. I want to create a small form which contains two text fields and the value entered in each would get stored in a variable in the controller.
My View Code
<h1>App</h1>
<h3>Enter Your Geolocation</h3>
<% form_tag get_GeoLocation do %>
<%= text_field_tag :my_longitude %>
<%= text_field_tag :my_latitude %>
<% end %>
In my controller i want to get values entered by user in the view and then do something with them. Please advice. I am using rails 4.2.0
Upvotes: 0
Views: 1028
Reputation: 571
Check out these tutorials, the last link specifically
http://guides.rubyonrails.org/form_helpers.html
http://guides.rubyonrails.org/getting_started.html
http://guides.rubyonrails.org/getting_started.html#saving-data-in-the-controller
Upvotes: 1