On my Rails Api, I have 3 models User, Property, and Address. Each Users and Properties can have one Address and Address is set as a polymorphic association as following:
address.rb
class Address < ActiveRecord::Base
belongs_to :locatable, polymorphic: true
end
user.rb
class User < ActiveRecord::Base
has_one :address, as: :locatable, dependent: :destroy
end
property.rb
class Property < ActiveRecord::Base
has_one :address, as: :locatable, dependent: :destroy
end
In my addresses
I have following fiels: locatable_type
and locatable_id
as well as the necessary fields for the address body.
My specs are passing on the rails side but when I am having hard to implementing this association in Ember. I use the ActiveModelSerializer gem on the rails side and the ActiveModelAdapter on the ember side.
So, I was wondering whether someone could point me to the direction to follow in order to getting these associations set in Ember.
Thanks,
Aucun commentaire:
Enregistrer un commentaire