We started the week with a feature request to rails for customized STI (Single Table Inheritance) type serialization. On the project we just finished, we needed to model a legacy database that serialized integers instead of class names for the STI type, and unfortunately we found that Rails had no real API for overriding the type serialization, so we added the following:
class Foo < ActiveRecord::Base self.inheritance_serializer = ->(klass) do # Map the class to the appropriate type identifier. # Defaults to `klass.name`. end self.inheritance_deserializer = ->(type_before_cast) do # Map the type identifier back into the appropriate class. # Defaults (approximately) to `type_before_cast.constantize`. end end
Ian also contributed a bug fix to ActiveRecord, fixing the
pluck method when the column name plucked is a reserved word.
We then continued with a pull request to rubygems.org for adding license information to gem version pages and version api requests. In our line of work, we have to keep a vigilant eye on the software licenses of our dependencies; adding more exposure of licenses can’t hurt.
This segued nicely into some much needed work on
LicenseFinder, an open source project Pivotal Labs created and maintains to automate the process of keeping track of your project’s license dependencies. We’ve added detection for two more license types (”LGPL” and “ISC”), added proper integration tests to the project, put the project on Travis-CI, and refactored some of the code along the way. In the future, we’d like to create a proper command line interface for
license_finder so that you can use it without