On 8/10/06, Dion Hewson <dionhewson@gmail.com> wrote:> > I have a 1 to 1 relationship using a similar example as below (has_one, belongs_to) > > but when I do the save, the foreign key of the child object is not set to the id of the parent object in the relation ship > > > any ideas? > > cheers > > dion > > --------------------------------- > > class Person < ActiveRecord::Base > has_one :address > validates_presence_of :email > --------------------------------- > > > end > class Address < ActiveRecord::Base > belongs_to :person > end > > ---------------------------------- > > person = Person.new > > person.email = "bruce@tate.com" > address = Address.new > address.city = "Austin" > person.address = address > person.save > person2 = Person.find_by_email "bruce@tate.com" > person2.address.city > => "Austin" > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060809/88e6382a/attachment.html