The problem you are having is because you have existing records in your database that don't have content associated to them. This happens because you went from a non-polymorphic setup to a polymorphic setup. What you need to do is look for shouts that are missing content_type and content_id and remove them from the database. Once those are removed, it could be useful to add
validates_associated :content
to your Shout model to ensure data in the future doesn't end up "corrupting" your database.