title: passing data from view to controller using a form in rails
body: <p>I have been reading rails documents and guides all day and trying out different tutorials all day but nothing seems to help. I currently have a small app which has a stop table, a bus table and a schedule table. The schedule table is a rich join between bus and stop table. I understand the db and model part of rails clearly compared to the controllers and views.</p>
  
  <p>My stop table has a id field, a longitude field, and a latitude field. </p>
  
  <p>I basically want user to input a value for longitude and latitude and then do a query and find out the stop id by matching the user given longitude and latitude in the stop table. </p>
  
  <p>What is the best way to achieve this? In my opinion i can create a form which will let user enter longitude and latitude and i can store that value in some variable and then do a query. I know exactly what i want to do but i don't know how to do it in rails. I am very frustrated and i would appreciate any input.</p>
  
  <p>My code for form in index.html.erb</p>
  
  <pre><code>&lt;%= form_for :welcome do |f| %&gt;
  
      &lt;%= f.label :longitude %&gt;&lt;br&gt;
  
      &lt;%= f.text_field :longitude %&gt;
      &lt;br&gt;
      &lt;br&gt;
      &lt;%= f.label :latitude %&gt;&lt;br&gt;
      &lt;%= f.text_field :latitude %&gt;
  
  
    &lt;p&gt;
      &lt;%= f.submit %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>My code for controller</p>
  
  <pre><code>class WelcomeController &lt; ApplicationController
  
    def index
       @long = params[:longitude]
       @lat =  params[:latitude]
    end
  
  
  end
  </code></pre>
  
  <p>Please inform me if i am doing something wrong? Also how do i proceed from here onwards? I would really appreciate any help i have been stuck at this same point for the past 8 hours. </p>