Module: FriendlyId::Slugged

Defined in:
lib/friendly_id/disabler.rb

Overview

The Slugged module is an extension of FriendlyId''s functionality, providing a way to customize how object URLs are generated with slugs.

Instance Method Summary collapse

Instance Method Details

#to_param ⇒ String

Overrides the default to_param method to conditionally return the record''s ID when FriendlyId is disabled, otherwise leveraging the slug functionality.

Returns:

  • (String) —

    the URL-safe parameter string representing the object.



43
44
45
# File 'lib/friendly_id/disabler.rb', line 43

def to_param
  ::FriendlyId::Disabler.disabled? ? id&.to_s : super
end