Topic: select in partial

Hi all,

I use a drop down list (select) in a partial.

<%= select('treeview', 'kind', %w{ Club Ploeg Tak }) %>

The partial is called treeview and it has a variable kind. If
treeview.kind matches or Club or ploeg or Tak then one of them should
be selected.

Since select expects a instance variable this doesnt't seem to work. I
already tried
@temptree = treeview and then

<%= select('temptree', 'kind', %w{ Club Ploeg Tak }) %>
but Club is always the selected value.

Since I'm really stuck here all help is greatly appreciated.

Thanks
Stijn

Re: select in partial

First off, is "kind" used for Single Table Inheritance? If so, try this in the controller new action (assuming that is rendering the partial.

def new
  @treeview = Tak.new
end

If it's not used for Single Table Inheritance, try this:

def new
  @treeview = Treeview.new(:kind => 'Tak')
end

Railscasts - Free Ruby on Rails Screencasts