Showing posts with label select box. Show all posts
Showing posts with label select box. Show all posts

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