Ask for Help
“Does Active Record have batched insert? I need to dump 10,000 rows into the database in process and I don’t want it to take 45 seconds.”
The upshot: use a raw SQL
For a day as interesting as today (1/11/11 anyone?) there were surprisingly few interesting things of note.
Ask for Help
A pivot asks: “Anyone know anything about data warehousing & ETL?”
A handful of pivots raise their hands.
Another pivot asks: “How about Radiant CMS?”
More pivots raise their hands.
before(:all) in Rspec raise an exception the return code coming back is 0. This breaks CI.
before(:suite) — this runs, just once, before all other befores.
In MongoMapper if you have a key (field) with type Hash, and set a default value, that default value points to a reference instantiated at class loading time. Instances inherit a reference to the same object (instead of a copy) which means any changes to to an instance with the default value propagate to all future instances using default. The immediate work-around is to wrap the value in a lambda, but within hours of reporting the bug there was a fix on HEAD.
splunk users meetup here (at Pivotal Labs in SF) on Wednesday January 12th. More details on meetup.com.
A global Rspec
before(:each) defined in
spec_helper.rb apparently does not have access to fixtures. One admittedly klunky workaround involves
config.include a Module, and then a
class_eval inside the included hook of the module. This has the unfortunate property that the
before(:each) will run multiple times, once at every test level, instead of just once at the top level — though this can be fixed by looking at the length of ancestors in the included hook in the module and only doing the
before(:each) if you are on the first level. Others argued that fixtures should be available in a
before(:each) and that the problem is a load-order issue.