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

hyper-mesh ignores associations for subclasses #29

Open adamcreekroad opened 7 years ago

adamcreekroad commented 7 years ago

When accessing associations on records that are subclassed, hyper-mesh only checks the associations on the records base_class

ex code

class User < ActiveRecord::Base
  ...
end

class Administrator < User
  belongs_to :job
  ...
end

class Job < ActiveRecord::Base
  has_one :administrator

  def name
    @name
  end
end

Calling it in JS console.

admin = Opal.Administrator.$last()
> $User {$$id: 3812, backing_record: $Base}
admin.$job().$name()
> undefined method 'name' for {"id"=>1, "name"=>"My First Job"}
sfcgeorge commented 6 years ago

Possibly related to #39 STI class issues. I also have subclasses in the work app so will see if I run into this issue as well.