my models: content has_many keys
I don’t understand how is it possible that empty array will have
‘build’ method?
@content = Content.create(:text => ‘test’)
=> #<Content id: 3, text: “test”, created_at: “2010-04-28 19:04:19”,
updated_at: “2010-04-28 19:04:19”>
@content.keys
=> []
but this works. can someone explain how can it be?
@content.keys.build
=> #<Key id: nil, name: nil, content_id: 3, created_at: nil,
updated_at: nil>
Thanks