Thanks for the advices

Matt do you mean that I should use
relationship.related_person=Person.new instead of changing the foreign
key directly
If so, is that a general requirement when updating foreign keys ?

Andrew
How do I avoid the caching/stale record process
I have tried to make an extra save for all involved object but did not
change anything

On 22 Juni, 13:29, Matt Jones <[email protected]> wrote:
> On Jun 21, 4:27 am, Hans <[email protected]> wrote:
>
> > I'm trying to set up a self-referential relationship, as described in
> > this great video 
> > -http://railscasts.com/episodes/163-self-referential-association
> > - and it's mostly working, but not entirely.
>
> > My self-referential relationship describes relationships between
> > people using the foreign keys person and related_person in class
> > Relationship both associating to the class Person
>
> > My problem is that when I update related_person_id for a specific
> > relationship  the associated object relationship.related_person is not
> > updated. Related_person_id in relationship has an updated value,
> > while  relationship.related_person.id has the old value.
> > What is wrong in my declarations ??
>
> Nothing, but updating the related_person_id field is the problem.
> You'll typically want to update the relationship with an object
> (assigning to related_person).
>
> --Matt Jones

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