emuen
1
I have the following line
<%= collection_select_with_current("permissions", :permission,
Permission.find(:all, :order => "name"), :id, :short, @page.permissions,
{:multiple => true}) %></label></p>
This generates a selectbox, with multipleselect enabled. It posts
correctly, but it does not mark the selected ones as I had hoped it
would. The code is originally from
http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers.
Can anyone help me make the current selected items get the
selected="selected"
tag.
emuen
2
<% @all_permissions = Permission.find(:all, :order => “name”) %>
<% @selected = @page.permissions.collect { |p| p.id } %>
<%= options_from_collection_for_select(@all_permissions, :id, :short,
@selected) %>
Felipe Mesquita http://felipemesquita.com/
http://felipemesquita.com
On Mon, Mar 24, 2008 at 3:24 PM, Emil K. <
[email protected]> wrote:
http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers.
Can anyone help me make the current selected items get the
selected="selected"
tag.
–
Felipe Mesquita
http://felipemesquita.com