I need to set a has_one through association to an unsaved record. In
my code
--
class JobPositionPosting < ActiveRecord::Base
has_one :job_position_posting_hiring_org
has_one :hiring_org, :through => :job_position_posting_hiring_org
end
class JobPositionPostingHiringOrg < ActiveRecord::Base
belongs_to :job_position_posting
belongs_to :hiring_org
end
class HiringOrg < ActiveRecord::Base
has_many :job_position_posting_hiring_org
has_many :job_position_posting, :through
=> :job_position_posting_hiring_org
end
job_position_posting = JobPositionPosting.new
hiring_org = HiringOrg.new
job_position_posting.hiring_org = hiring_org
--
, job_position_posting.hiring_org is always set to nil. If i save
job_position_posting and hiring_org everything works fine. How can i
realize an has_one :trough with new records?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---