Q:

passing data from view to controller using a form in rails

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.
My stop table has a id field, a longitude field, and a latitude field. 
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. 
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.
My code for form in index.html.erb
<%= form_for :welcome do |f| %>

    <%= f.label :longitude %><br>

    <%= f.text_field :longitude %>
    <br>
    <br>
    <%= f.label :latitude %><br>
    <%= f.text_field :latitude %>

  <p>
    <%= f.submit %>
  </p>
<% end %>

My code for controller
class WelcomeController < ApplicationController

  def index
     @long = params[:longitude]
     @lat =  params[:latitude]
  end

end

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. 

A:

First of all, make sure you model is represented in the database, have you run a migration, can you post your schema? 
If you are starting from scratch, you could run this command to get up and running quickly with the model:
bin/rails generate model Location latitude:string longitude:string

bin/rake db:migrate

UPDATE: If you don't need the user Location to persist in the database, you can use ActiveModel (skip the above). In the models folder create a location.rb file and create the ActiveModel:
class Location
  include ActiveModel::Model
  attr_accessor :latitude, :longitude
end

Now that Location model is in place, you'll need to save the latitude and longitude using a create method in the controller:
def create
  @location= Location.new(params[:location])

  @location.save
  redirect_to @location
end

UPDATE: now that you've captured the user location, you want to use this information to compare it to your Stop table in order to find the record that is relevant. Here, you'll want to do this work using resque (or other queue) or by making a call to a third-party API like Google maps for example, or use whatever algorithm you've come up with.
You also want to make sure that you have routes, the default CRUD routes can be achieved by:
Rails.application.routes.draw do

  resources :location
end

finally in your view (note I'm using the model name location instead of welcome):
<%= form_for :location do |f| %>
  <p>
    <%= f.label :latitude %><br>
    <%= f.text_field :latitude %>
  </p>

  <p>
    <%= f.label :longitude %><br>
    <%= f.text_area :longitude %>
  </p>

  <p>
    <%= f.submit %>
  </p>
<% end %>

