search for: select_from_db

Displaying 1 result from an estimated 1 matches for "select_from_db".

2006 Feb 27
0
Example code for select_from_db (a.k.a. combo box)
...found this when I was looking myself as an example of how this could be done, so here it is for others). - Peter P.S. My model is Asset and controller is Assets (obviously), change those instances below for your own model/controller names. ==== app/helpers/application_helper.rb ==== def select_from_db(object, method, choices, options = {}, html_options = {}) results = Asset.find(:all) if choices.blank? if results choices = Array.new results.each do |result| unless result.send(method).blank? choices << result.send(method) end e...