I have Gallery
and Image
models with has_many/belongs_to relationship.
My admin_active form for Image looks like this:
form do |f|
f.inputs "Image Details" do
f.input :gallery_id
f.input :file
end
end
Instead or entering number for gallery_id I'd like to chose gallery name from drop-down list. By deafault this form looks like this, but I don't know how to do this manually.
Change your form to the following
form do |f|
f.inputs "Image Details" do
f.input :gallery_id, as: :select, collection: Gallery.select(:name).uniq
f.input :file
end
end
Try this
form do |f|
f.inputs "Image Details" do
f.input :gallery
f.input :file
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With