Module: Sequel::Plugins::ExternalId::ClassMethods

Defined in:
lib/sequel/plugins/external_id.rb

Instance Method Summary collapse

Instance Method Details

#has_external_id(prefix) ⇒ Object

Called inside a model's body to indicate that this model has an external_id that this plugin should manage and what prefix should be used. Calling this will also alter InstanceMethods#to_s to include this id in the string representation.

Parameters:

  • prefix (String)

    a short string identfying the type of this model. It will be prepended to your external_id.



40
41
42
43
# File 'lib/sequel/plugins/external_id.rb', line 40

def has_external_id(prefix)
  global_prefix = find_global_prefix
  @external_id_prefix = RichString.new("#{global_prefix}#{prefix}").to_s_or_nil
end