Topic: i want to fetch the data's from the datanase. it display in combo box

hi,

  i want to fetch the data's from the datanase. it display in combo box .

but i am very new to ROR. so i don't know what are all the steps to do this. like where i have to put in controllter or in rhtml file.

  Can any one tell step by step process, if u can. please its very urgent.

my database name is : panles

it contain - id,name.

combo box i want to display - panel name.

controller name is - home

rthml file is - index.rhtml

right now i have done index.rhtml only, rest i don't know how to do

<%=
@panles = panel.find(:all, :panel => "name")
collection_select(:panel, :name, @panels, :id, :name)
%>

but it shows the error.

please help me asap

Re: i want to fetch the data's from the datanase. it display in combo box

I take it you want to show a select menu with the name of all panels in it? You can do this in the controller to fetch the panels:

@panels = Panel.find(:all, :order => 'name')

Are you using this to set the attribute/association of another model? Something like this in the view:

<%= collection_select :some_model, :panel_id, @panels, :id, :name %>

If you aren't using  this select menu to set a relationship, use the select_tag method:

<%= select_tag :panel_id, options_from_collection_for_select(@panels, :id, :name) %>

Railscasts - Free Ruby on Rails Screencasts