sorry now i see it makes no sense, i understood that this is all in your
seed.rb and both functions will only be used once and i was suggesting this

100.times do
  user = User.new
  user.username = Faker::Name.first_name
  user.email = user.username+"@example.com"
  user.save!
  write_comments(user)   <===  this could be in your controller create
action
end

protected
def write_comments(user)
 comment = Comment.new
 comment.text = "some text"
 comment.user = user
 comment.save!
end


After paying more attention to your comment i notice you want the
write_comments to be in your model in production, and my suggestion made no
sense.




On Mon, Sep 13, 2010 at 3:47 PM, Heinz Strunk <[email protected]> wrote:

> > put the function in the loop after the user.save ?
> What exactly do you mean by put it in the loop after .save?
> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://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