views:

26

answers:

1

In my project i have this combo box, and it works perfectly:

<%= collection_select @project, @project.clients.id, @project.clients, :id, :name %>

My simple and quick question is, how can i render this in a partial, I'm using this and it's not working...

<%= render :partial => "clients", :collection => @project.clients, :locals => {:project => @project }%>

and the partial code is:

<%= collection_select :project, clients.id, clients, clients.id, clients.name %
+2  A: 

Try this within your partial:

<%= collection_selection project, project.clients.id, project.clients, :id, :name %>

(When you refer to template instance variables that are passed in to the partial as locals, use the non-symbol form of the variable name.)

John Topley
Works perfectly, thank you.
Gotjosh