I am doing something like this to insert multiple records at the same time in my rails app.
VoteRecord.create(
[
{ :prospect_id => prospect.id, :state => "OH", :election_type => "GE" },
{ :prospect_id => prospect.id, :state => "OH", :election_type => "PR" }
...
]
)
When I check the log i see that the insert query is fired multiple times by sql. Is it possible to do this in a single query?
您可以尝试使用活动记录导入进行批量导入、签出 wiki 和示例页面。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.