Re: HABTM with multiple select list

Inessa Weiner
2006-07-03T13:33:14Z

Nothing is getting save in the middle table if I am using

  @title.categories Category.find(params[:categories_ids]) if
params[:categories_ids]

However trace shows that
"..categories_ids"=&gt;["2"].

if I omit

 if params[:categories_ids]

The same error comes up:

Could''t  find Category without an ID

Please help.

At 03:20 PM 6/30/2006 -0400, you wrote:

Hi,

Inessa Weiner wrote:

@title.categories &lt;&lt; Category.find(@params[:category_ids])
.

.

.

Category
Mappings:

&lt;% options = options_from_collection_for_select (@categories,
''name'',''id'', @category_ids) %&gt;

&lt;%= select_tag(''categories_ids[]'', options,
{:multiple=&gt;true,
:size=&gt;7}) %&gt;

----

I am getting error:

Couldn''t find Category without an ID

I think it should be:

  @title.categories = Category.find(params[:categories_ids]) if
params[:categories_ids]

Regards,

  Ali

_______________________________________________

Rails mailing list

Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org

http://lists.rubyonrails.org/mailman/listinfo/rails


_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org