Module: HasUniqueIdentifier::InstanceMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/has_unique_identifier/instance_methods.rb

Constant Summary collapse

DEFAULT_RANDOM_IDENTIFIER_LENGTH =
24
DEFAULT_SAFE_CHARS =
(
  ('A'..'Z').to_a +
  ('a'..'z').to_a +
  ('0'..'9').to_a +
  %w[- _ ~]
).freeze

Instance Method Summary collapse

Instance Method Details

#to_paramObject



13
14
15
16
17
18
19
20
# File 'lib/has_unique_identifier/instance_methods.rb', line 13

def to_param
  if self.class.unique_identifier &&
    self.class.unique_identifier.options[:to_param] == true

    return send(self.class.unique_identifier.name)
  end
  super
end