How to populate combobox from db?

Hello Friends,
I am a newbie in ROR.
Can you plz tell me how to populate the combobox with data from db?If
you could give both the view and controller part it would be helpful.I
am using a Mysql database

on Controller

or you can use this in your view:

<%= collection_select(:video, :category_id, Category.all, :id, :name)

Category.all can be called in your controller and passed to the form
tag as instance variable... something like

@categories = Category.all


<%= collection_select(:video, :category_id, @categories, :id, :name)

Bala wrote:

on Controller

def index
   @categories = Category.find(:all)

on View
<%= select("post", "category_id", @categories.collect {|p| [, ]
}, {:include_blank => 'None'})%>

Thank you so much.....Ur code exactly worked for me....