Effectively the same, but because the array variants of create and
update already exist it is a matter whether to pass the block to each
record in the array. It doesn't have to but I was wondering if it
would cause confusion. But on thinking it through I think it makes
sense to me.
Adam
On Apr 23, 7:39 am, "Ian White" <[EMAIL PROTECTED]> wrote:
> > Person.create([{:name => 'Adam'}, {:name => 'Jeremy'}]) do |p|
>
> > p.set_status(:cool)
> > end
>
> ['Adam', 'Jeremy'].each do |name|
> Person.create do |p|
> p.name = name
> p.set_status(:cool)
> end
> end
>
> is not that different, and just uses a common ruby idiom
>
> Cheers,
> Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---