module Sluggable::Rails::Concern::ClassMethods
Public Instance Methods
has_slug(attribute = :slug, by:, separator: '-', scope: nil)
click to toggle source
# File lib/sluggable/rails/concern.rb, line 13 def has_slug(attribute = :slug, by:, separator: '-', scope: nil) slug_definitions.add attribute, origin: by, separator: separator, scope: scope validates attribute, presence: true, uniqueness: scope.present? ? { scope: scope } : true end
slug_definitions()
click to toggle source
# File lib/sluggable/rails/concern.rb, line 18 def slug_definitions @slug_definitions ||= Sluggable::Rails::Definitions.new end