I've come across an issue that I'm sure is a bug when using after_create
with a has_one association, but I'm not 100% certain if I'm missing
This is pretty much exactly the code I'm using. Two simple classes
(Account and Contact) and I create the contact after I create an account
(via after_create). I'm not passing in a "name" field which the contact
requires via validates_presence_of, so the contact should not get saved,
but it in fact does.
class Account < ActiveRecord::Base
class Contact < ActiveRecord::Base
class AccountTest < ActiveSupport::TestCase
test "this ain't right" do
a = Account.create
#<Contact id: 996332878, name: nil, account_id: 1, created_at:
"2009-05-25 05:40:40", updated_at: "2009-05-25 05:40:40">
Is this expected behaviour?