ruby-hyperloop / hyper-mesh

The project has moved to Hyperstack!! - Synchronization of active record models across multiple clients using Pusher, ActionCable, or Polling
https://hyperstack.org/
MIT License
22 stars 12 forks source link

Regression - child relationships are not being handled during fetch and validate #99

Open catmando opened 6 years ago

catmando commented 6 years ago

These specs will fail:

  it "can validate the presence of an association" do
    TestModel.validates_presence_of :child_models
    expect_promise do
      @test_model = TestModel.new
      @test_model.child_models << ChildModel.new
      @test_model.validate.then { |test_model| test_model.errors.messages }
    end.to be_empty
  end
  it "the server method can access any unsaved associations" do
    isomorphic do
      TestModel.server_method(:test) { child_models.count }
    end
    expect_promise do
      test_model = TestModel.new
      ChildModel.new(test_model: test_model)
      ReactiveRecord.load do
        test_model.test
      end
    end.to eq(1)
  end

(the child relationship is not being correctly rematerialized on the server)