You may try: usertodelete = req.users.find(params[:id]) # Get the user to destroy usertodelete.destroy
Charanya Nagarajan wrote: > hi, > i have 3 models > 1.request > 2.user > 3.requesttargetuser > > Requesttargetuser > belongs_to :request > belongs_to :user > > User > has_many :requesttargetusers, :dependent=> :destroy > has_many :requests,:through => :requesttargetusers > > Request > has_many :requesttargetusers,:dependent=> :destroy > has_many :users, :through=>:requesttargetusers > > Now when i want to add a user as requesttargetuser for a request > > I jus use > > req=Request.find(:last) > targetuser=user.find(:last) > > req.users<<targetuser > > If i want to remove a user from the users list of a request,is there any > method similar to that of adding? > > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

