From: Junkone Date: 2007-12-08T00:54:59+09:00 Subject: Re: help with has_and_belongs_to_many On Dec 7, 9:45 am, Rick DeNatale wrote: > On 12/7/07, Junkone wrote: > > > i get error when assigning many to many relationship > > >> a=Trade.find(1) > > => #"O", "size"=>nil, > > "mfe"=>nil, " > > tradestrategy"=>nil, "symbol_alias"=>"PRGX", "tradeinterval"=>"DAILY", > > "getpictu > > res"=>nil, "tradename"=>nil, "id"=>"1", "mae"=>nil, > > "grossrevenue"=>nil, "tradec > > omments"=>nil, "tradedirection"=>"Short"}> > > >> z=Tag.find(1) > > => #"1", "description"=>"exampe1"}> > > >> a.tags=z > > NoMethodError: undefined method `each' for # > > from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > > You don't replace a habtm relationship with an assignment, you add to it > > a.tags << z > > -- > Rick DeNatale > > My blog on Rubyhttp://talklikeaduck.denhaven2.com/ thanks. how do you do the reverse. if i want to remove an existing relationship.