Polymorphic associations without inheritance


I use Ember Data with ActiveModelAdapter.

In my rails backend I have this polymorphic association:

class Schedule < ActiveRecord::Base
  has_many :schedule_ranges, as: :schedule

class ScheduleTemplate < ActiveRecord::Base
  has_many :schedule_ranges, as: :schedule

class ScheduleRange < ActiveRecord::Base
  belongs_to :schedule, polymorphic: true

It results that the association ‘schedule’ in ‘ScheduleRange’ has the same name than the polymorphic model ‘Schedule’.

In ember-data it’s not possible to use inheritance to define polymorphic association because the parent and the child would have the same name.

I can’t find a solution tu use my backend with ember-data. Can you help me?

I haven’t tried this myself but I bumped into this the other day whilst looking on stack over flow.

There is also this:

Polymorphic associations tutorial

But this is justly this implementation that doesn’t allow to use my naming case.