On Apr 28, 8:09 pm, oren <[email protected]> wrote:
> my models: content has_many keys
> I don't understand how is it possible that empty array will have
> 'build' method?

Because it's not actually an array - it's an association proxy.

Fred
>
> @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
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to