Instead of doing something like:100.times{|i| Thing.create(:name=>i}
I want to do something like:
Thing.create_many((0...100).map{|i| {:name=>i})
DataObjects's create accepts an array of resources, but unfortunately does
each one as a separate create.
Three reasons may be:
- resources not all being of the same model (table)
- error / validation concerns
- size limitations of the INSERT statement
It seems relatively simple to do something like this, so I'm surprised it
hasn't been done before.
Has it been done, or is there a gotcha I'm waiting to discover?
Thanks,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---