hyper-mesh icon indicating copy to clipboard operation
hyper-mesh copied to clipboard

hyper-mesh ignores associations for subclasses

Open adamcreekroad opened this issue 8 years ago • 1 comments

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

adamcreekroad avatar May 24 '17 15:05 adamcreekroad

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.

sfcgeorge avatar Oct 23 '17 09:10 sfcgeorge