Another question from me, a new person to ROR.
table a (has column id and name) and table b (has column id and name),
they have many_many relationship. so, joint table a_b introduced. a_b
only has a_id and b_id.
I am using
<% for b in @bs %>
  <%= check_box("b", b.id, (@a.bs.include?(b) ?
{:checked => ''checked''} : {:checked => false} )) %>
<%= b.name %>
<% end %>
to show all available b for a. it works.
I am using
  def update
    @a = A.find(params[:id])
    b = B.find(params["b"].to_i)
    unless @a.bs.include?(b)
      @a.bs << b
    end
    if @a.update_attributes(params[:a])
      flash[:notice] = ''A was successfully updated.''
      redirect_to :action => ''show'', :id => @a
    else
      render :action => ''edit''
    end
  end
to save all info into table a and joint table a_b
however, I got the following error message:
 NoMethodError in AController#update
undefined method `to_i'' for {"1"=>"1",
"2"=>"0", "3"=>"0",
"4"=>"1"}:HashWithIndifferentAccess
Any idea how to fix it? thanks.
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---