It also adds documentation to most of the method in the active record base and mysql_adapter files.
An example of this is: class LogEntry < ActiveRecord::Base ; end
hashes = LogFileReader.read_log_entries( ‘file.log’ ) n = LogEntry.import hashes
puts “That took #{n} database inserts”
The beauty of this is that if your LogFileReader parsed 10 entries or 1,000,000 entries the number of inserts to the database is going to be the minimum number of inserts that is required by your database. It is 20x to 30x faster then ActiveRecord::Base.create
-
- 3 should be out this weekend and it is scheduled to have Postgresql support for ActiveRecord::Base.import and import with validations. Currently all imports all done w/o model validation.
-
- 2 can be downloaded here
blog comments powered by Disqus