0
나는 서비스에서 Users
을지도하는 ActiveResource
객체를 사용하고 싶지만 난 내가 이런 걸 보이는 코드가 이러한 Users
ActiveResource 객체에서 has_many 메서드를 사용하여 로컬 ActiveRecord 객체에 연결 하시겠습니까?
와 연결하려는 로컬 데이터가 있습니다
user.rb를 :
class User < ActiveResource::Base
self.site = "http://my/api"
has_many :notifications, as: :notifiable, dependent: :destroy
attr_accessible :notifications_attributes
accepts_nested_attributes_for :notifications, allow_destroy: true
end
notification.rb :
class Notification < ActiveRecord::Base
belongs_to :notifiable, polymorphic: true
belongs_to :user
belongs_to :recipient, class_name: 'User'
end
ActiveResource
이 has_many
을 지원하지 않는 경우이 문제를 어떻게 해결해야합니까?
Ahhh ok. 나는 이것을 시험해야 할 것 같아. 나는 지금 당장 +1하고 나중에 받아 들여야한다. 이것이 단단한 해결책이된다면. – DJTripleThreat