Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Christopher Swasey (endash)'s latest activity

Monday, May 19 2008
220 habtm: collection.build doesn't build join associations (unlike collection.cr... was updated in Ruby on Rails
  • Christopher Swasey (endash)
    Christopher Swasey (endash) commented at 6:09 AM

    I am just all kinds of wrong tonight. You can, of course, call #build on a new record just fine. (it's #create that you can't call on a new record)

  • Christopher Swasey (endash)
    Christopher Swasey (endash) commented at 5:27 AM

    Ah... the two records want to validate each other. That results in a nice runaway loop.

    Code could be added to the validation to prevent looping, but I'm wond...

  • Christopher Swasey (endash)
    Christopher Swasey (endash) commented at 4:47 AM

    A quick look through the source seems to suggest that simply adding the existing record to the association collection of the new record would create the desire...

  • Christopher Swasey (endash)
    Christopher Swasey (endash) commented at 4:10 AM

    From what I can tell, this isn't a bug:

    When you #build off an association, the join table is updated when you call #save on the object from which you called ...

  • Christopher Swasey (endash)
    Christopher Swasey (endash) commented at 3:51 AM

    I misread the ticket, and I was wrong about the tests covering this case.

1 earlier change…
  • Christopher Swasey (endash)
    Christopher Swasey (endash) commented at 3:38 AM

    Could you clarify what version of rails you are using? Edge rails includes tests which test this functionality, and they all pass.

    Also, #build doesn't save t...