hi everyone, I''ve seen a lot of examples for complex forms which involves all kinds of associations (railscasts, app examples on github, etc.), only has_many :through have been left in the dust a bit. I''m taking advantage and toying around the new :accessible => true for mass assignments on new records; however I want to ask if somebody have an example on how to use properly the handling of has_many :through associations in edge. Let''s say in my create action of the interested controller I have this: def create ... @report = @document.reports.build(params[:report]) if @report.save ... Report has_many Reason :through the join table, so in my form partial I''ve the classic fields_for which does pass the natural "report"=>{"when(1i)"=>"2008", "when(2i)"=>"8", "when(3i)"=>"29", "reasons"=>[{"content"=>"my reason"}]} Remember that in Report model there''s the new :accessible for mass assignment: has_many :report_reasons has_many :reasons, :through => :report_reasons, :accessible => true This works well and it does keep one clean line in controller for building up the @report instance. The problem with has_many :through is that every time the Report gets saved, it creates new entries for every Reason instead of assigning one that already exists (of course). Do you have any hints how to manage cleanly this situation? callbacks, real code examples, etc. can help me greatly. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---