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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---