Module: Mongoid::Translation::Slug

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid/translation/slug.rb

Instance Method Summary collapse

Instance Method Details

#set_slugObject

Slug creation.

Returns:

  • (Object)


19
20
21
22
23
24
25
26
27
# File 'lib/mongoid/translation/slug.rb', line 19

def set_slug
  if self.slug.blank? && slugged_field.present?
    if translation_parent_class.send(:by_slug, slugged).one
      self.slug = slugged_with_token
    else
      self.slug = slugged
    end
  end
end