Please quote when replying; otherwise, it gets difficult to follow the 
discussion.

Heinz Strunk wrote:
> @Marnen: Actually they're not really users but NPCs which I need for 
> various things and I need a lot of them to populate the world.
> 
> Therefore it's not for test but to populate 

So this is actual production data?

> and I don't think factories 
> are good for so many objects, right?

Factories should be fine for creating so many objects -- but they're not 
for creating production data.

If it's production data, create it all and use seeds.
If it's test data, create only the few records you need and use 
factories.

[and, from earlier post]
> This works just fine and the users have been created after I ran
> db:seeds but what's not working is:
>
> after_create :write_comments
>
> protected
> def write_comments
>  comment = Comment.new
>  comment.text = "some text"
>  comment.user = self
>  comment.save!
> end

It's not appropriate to use an after_create for this sort of thing, I 
think.  In your 100.times block, just create a comment when you create 
each user.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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 [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