Select ... :index => nil is not working

Dear all

I have been trying to get this piece of code working
http://pastie.org/236978

<% fields_for "daleel[categories_attributes][]", category do | category_form| %>

category: <%= category_form.select "category_id", @categories, :prompt => "category", :index => nil %>

        <% if category.new_record? %>
            <%= link_to_function "remove", "$

(this).up(‘.task’).remove()" %>
<% else %>
<%= link_to_function “remove”,
“category_for_destroy(this)” %>
<%= category_form.hidden_field :id, :index => nil %>
<%= category_form.hidden_field :should_destroy, :index
=> nil, :class => ‘should_destroy’ %>
<% end %>


<% end %>

The problem is this

the select statement should hide the id however, it does not work for
select and it works for the hidden field. I was trying hard to get it
working in the past two days. I tried to put :index => nil in
the :options and :html_options and the same problem did not get
solved

this concept was gotten from #75 Complex Forms Part 3 - RailsCasts

Thanks in advance

any idea

On Jul 19, 6:15 am, Shuaib85 [email protected] wrote:

The problem is this

the select statement should hide the id however, it does not work for
select and it works for the hidden field. I was trying hard to get it
working in the past two days. I tried to put :index => nil in
the :options and :html_options and the same problem did not get
solved

this concept was gotten fromhttp://railscasts.com/episodes/75

Did you see the note at the bottom of that episode:

“The code for this screencast isn’t the greatest, it requires
the :index option for the fields and does not work well in Rails 2.
Instead I recommend going with the approach I show in Advanced Rails
Recipes”

Fred