Dear list,
At the moment I am working on an app which has a good few models and
associations. In short:
A :has_many B
B :belongs_to A
Now I want to update A when I have saved B, so I wrote a after_save
filter. However the update of A entails looking at all associated B’s
so I wrote something like:
self.Bs.each do |b|
#do something
end
This did not work. It iterated alright but almost all attributes in B
were empty. Writing:
self.Bs.find(:all).each do |b|
#do something
end
This did work! Why?
With kind regards,
Harm