Return to Snippet

Revision: 20751
at November 24, 2009 11:21 by smoothdzion


Initial Code
# Replace |model| with whatever you want to use. ie. |whatever|
<%= select(:object, :name, Model.all.collect {|model| [model.name, model.id]}) %>

Initial URL

                                

Initial Description
The code to find all objects from a model and use them as select options.

Initial Title
RoR - Select Box Using Existing Model

Initial Tags
html, rails, ruby

Initial Language
Rails