Module: Mongoid::Slugs::ClassMethods

Defined in:
lib/mongoid/slugs.rb

Instance Method Summary collapse

Instance Method Details

#find_by_slug(slug) ⇒ Object



23
24
25
# File 'lib/mongoid/slugs.rb', line 23

def find_by_slug(slug)
  find_by(slug: slug)
end

#slug_fieldObject



18
19
20
21
# File 'lib/mongoid/slugs.rb', line 18

def slug_field
  @@slug_field ||= {}
  @@slug_field[self.name]
end

#slug_on(field) ⇒ Object



13
14
15
16
# File 'lib/mongoid/slugs.rb', line 13

def slug_on(field)
  @@slug_field ||= {}
  @@slug_field[self.name] = field.to_sym
end