module Sequel::Plugins::InspectPk

  1. lib/sequel/plugins/inspect_pk.rb

The inspect_pk plugin includes the pk right next to the model name in inspect, allowing for easily copying and pasting to retrieve a copy of the object:

Album.with_pk(1).inspect
#         default: #<Album @values={...}>
# with inspect_pk: #<Album[1] @values={...}>

Usage:

# Make all model instances include pk in inspect output
Sequel::Model.plugin :inspect_pk

# Make Album instances include pk in inspect output
Album.plugin :inspect_pk