I am trying to extend the classic example
class Magazine < ActiveRecord::Base
has_many :subscriptions
has_many :rental_events ,
:through => : subscriptions,
:source => :redaer,
:source_type => 'Business'
has_many :closing_events ,
:through => : subscriptions,
:source => :reader,
:source_type => 'Person'
end
class Subscription < ActiveRecord::Base
belongs_to :magazine
belongs_to :reader, :polymorphic => true
end
class Business < ActiveRecord::Base
has_many : subscriptions, :as => :reader
has_one :magazine, :through => :subcription <---- that’s what I
want , only 1 magazine…
end
class Person < ActiveRecord::Base
has_many : subscriptions, :as => :reader
has_one :magazine, :through => :subcription <---- that’s what I
want , only 1 magazine…
end
I can easily get Person.first.subscriptions, but I cannot get
Person.first.magazine or Business.first.magazine
what’s wrong ? , thanks for your lights …
erwin