check for the class primary_key before using the hard-coded id in ActiveModel::Conversion#to_key