handle cyclic associations

cyclic associations lead to an infinite loop on dump, for instance

```ruby
class Order < ActiveRecord::Base
  has_many    :states
  belongs_to  :last_state, :class_name => 'State'
end

class State < ActiveRecord::Base
  belongs_to  :order
end
```

I suggest two changes which I have implemented as a PoC:

1. on dump: prevent following loops in the object association graph by saving and checking for objects already seen in the traversal
2. on load: when a referenced object is missing, put the referrer on a wait list and reload it when the referee is loaded - otherwise there would be missing foreign keys