views:

19

answers:

1

I am trying to draw the end result being that @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'

My controller :

def new
  @gallery = Gallery.new
  @galleries = @organization.galleries
end
A: 

Have you tried the following?

    = f.select :gallery, options_for_select(@galleries.collect { |g| [g.name, g.id] }), {}, :class => "gallery_title"

EDIT: looking at your form again, you are doing form_for :gallery. Does Gallery have a field named gallery or is it Organization that has gallery?

theIV
Hmm the background to this is its a temporary var I need to just set what the the url is when I send them to add to their gallery. Maybe a good place for an attr_accessor (not sure what those are really). Yes Organization has many galleries. Gallery does not have a field named gallery.
Trip
I don't fully understand what you mean. Maybe I can't picture the flow of the application so I'm having a hard time understanding. Are you storing anything in the database? If not, then yes, an attr_accessor might be the way to go.
theIV