我试图将最终结果绘制为@gallery = whatever i choose in my select
- form_for :gallery do |f|
.grid_6.hr_dots.clear
.exist_gal
.grid_5
%label
2. Or add to an existing Gallery
.clear
.grid_4
= select @gallery, :gallery, options_for_select(@galleries.collect { |g| g.name }), {}, :class => "gallery_title"
.grid_2
= link_to 'add photos', new_photos_organization_media_gallery_url(@organization.id, @gallery.id), :class => 'button add_photos_btn'
我的控制器:
def new
@gallery = Gallery.new
@galleries = @organization.galleries
end
答案 0 :(得分:0)
您是否尝试过以下操作?
= f.select :gallery, options_for_select(@galleries.collect { |g| [g.name, g.id] }), {}, :class => "gallery_title"
编辑:再次查看您的表单,您正在form_for :gallery
。 Gallery
是否有一个名为gallery
的字段,或者Organization
是gallery
的字段?