On 8 Sep 2009, at 13:44, David A. B > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> When I run my test,and goes wrong .Like this---> >> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ >> 1) Error: >> test_ferret(BookTest): >> ActiveRecord::HasManyThroughCantAssociateNewRecords: Cannot associate >> new record >> s through 'Book#authors_books' on '#'. Both records must have an id >> in >> order to >> create the has_many :through record associating them. > > Just looking at it quickly I suspect that it's because you're trying > to add an Author to an unsaved Book record, and that it's impossible > for the system to add a row to authors_books because it doesn't have > the necessary information (since unsaved records don't have id's). >
Rails 2.1 (or was it 2.2?) made has many through a lot more sane in that respect. Fred > > David > > -- > David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com > Ruby/Rails training, mentoring, consulting, code-review > Latest book: The Well-Grounded Rubyist (http://www.manning.com/black2) > > September Ruby training in NJ has been POSTPONED. Details to follow. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

