Hai friends,
I am a newbie in ROR.I hav created a select box which takes value
from the databaseI dont know how to get the id or index of the value
selected.
Controller:
class ReadingsController < ApplicationController
def index
@locations= Station.find(:all,:group => “state”,:order =>“state”)
end
end
View:
<% form_for :station ,:url => {:action => ‘index’,:id => @station } do
|form| %>
I want to display the readings according to the selected state
for eg: If I select “Karnataka” from the select box i should get all the
rows in that table whose state=“Karnataka”
My table schema is as below
create_table “stations”, :force => true do |t|
t.string “name”
t.string “unit_id”
t.integer “sim_no”
t.string “state”
t.string “district”
t.string “province”
t.integer “zipcode”
t.string “latitude”
t.string “longitude”
end
Please give me a reply?