0

I am using mongomapper inorder to associate 2 models together in a one-to-many relationship.

I want to show the ids of one model into the other models in the padrino admin section.

I am trying to use the <%= f.select %> of padrino forms. to mimic what in rails would be somthing like this with activerecord

Please advice on the f.select syntax for padrino's form.

zotherstupidguy
  • 2,976
  • 10
  • 39
  • 59

2 Answers2

0

it seems that <%f.select_block :model_attr, :options => Model.all %> do the trick.

zotherstupidguy
  • 2,976
  • 10
  • 39
  • 59
0

try this

  <% @options = Survey.where(:active => 1) %>
  <%= f.select :survey_id, :collection => @options , :fields  => [:name, :id] %>

The fields parameter will determine what goes in the value and what in the label

Dvid Silva
  • 1,110
  • 13
  • 25