Sunday, December 09, 2007

populating select box from database ror

controller code looks something like:

class testController < ApplicationController

def test
@categories= Category.find_all
end

end

use
<%= options_from_collection_for_select @categories, 'id', 'name' %>
to populate the select box


No comments: