So,Could you help me deal with my code ?

On Tue, Sep 8, 2009 at 9:46 PM, Frederick Cheung <[email protected]
> wrote:

>
>
> 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.
> >
> > >
>
>
> >
>


-- 
Sons of Gondor, of Rohan, my brothers!
I see in your eyes the same fear that would take the heart of me.
A day may come when the courage of men fails when we forsake our friends and
break all bonds of fellowship.
But this is not this day.
And hour of wolves and shattered shields when the age of Men comes crashing
down. But this is not this day!
This day we fight! By all that you hold dear on this good earth, I bid you
stand! Men of the West!

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to