On 29 June 2010 17:29, P.A. <shamaoke@hotmail.com> wrote:
> I got it.
>
> It should to break the creation statements onto a few steps:
>
> WHEN:
>
>>> one = Article.new(:title => 'one')
>
>>> one.author = Author.new(:name => 'Pavel')
>
>>> one.save
>
>>> two = Article.new(:title => 'two')
>
>>> two.author = Author.find(:first, :conditions => {:name => 'Pavel'})
>
>>> two.save
Have a look at
author.articles.build
which will build a new article for an author and save some messing about.
Colin
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment