/ Published in: Rails
The code to find all objects from a model and use them as select options.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# Replace |model| with whatever you want to use. ie. |whatever| <%= select(:object, :name, Model.all.collect {|model| [model.name, model.id]}) %>