A really noob question, but i try with different options and I dont get it.
I Have a form for a new "Cancha" and a field that references to "Mmpp", In the field mmpp_id i need to see a list with the differents kinds of "Mmpp" (already created some options), right now if I put for example "1" i get Mmpp:0x00007f7fb1600378 in the show, Already change the show to <%= @cancha.mmpp.nombre %> and I get exactly what I want in the show, but the problem is in the form I need a list to pick. Thanks in advance
<%= form.text_field :mmpp_id, class: 'form-control' %>
create_table "canchas", force: :cascade do |t|
t.string "nombre"
t.string "descripcion"
t.integer "capacidad"
t.boolean "operativa"
t.bigint "mmpp_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["mmpp_id"], name: "index_canchas_on_mmpp_id"
create_table "mmpps", force: :cascade do |t|
t.string "nombre"
t.string "descripcion"
t.integer "densidad"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
This was simpler and with the same html classes of the other inputs, form.select work but give some style problems.
<%= f.association :mmpp_id, label_method: :nombre, value_method: :id %>