Hi, Can someone help me with this, why does it not work when the association is already set, shouldn''t it be overridden? require ''rubygems'' require ''activerecord'' ActiveRecord::Base.establish_connection(:adapter => ''sqlite3'', :database => '':memory:'') class Rider < ActiveRecord::Base connection.create_table :riders, :force => true do |t| t.string :name end has_many :starts end class Start < ActiveRecord::Base connection.create_table :starts, :force => true do |t| t.string :class_no t.integer :rider_id end belongs_to :rider end # Why is not this true? other_rider = Rider.create start = Start.new(:rider => other_rider) rider = Rider.create(:starts => [start]) puts rider.starts.reload.size == 1 # => false # This works rider = Rider.create(:starts => [Start.create]) puts rider.starts.reload.size == 1 # => true # And this rider = Rider.create(:starts => [Start.create(:rider_id => Rider.create.id)]) puts rider.starts.reload.size == 1 # => true Thanks -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.