module Slugworth::ClassMethods

Public Instance Methods

find_by_slug(slug) click to toggle source
# File lib/slugworth.rb, line 24
def find_by_slug(slug)
  find_by(slug: slug)
end
find_by_slug!(slug) click to toggle source
# File lib/slugworth.rb, line 20
def find_by_slug!(slug)
  find_by!(slug: slug)
end
slugged_with(slug_attribute, opts = {}) click to toggle source
# File lib/slugworth.rb, line 12
def slugged_with(slug_attribute, opts = {})
  self.slug_attribute = slug_attribute
  self.slug_scope = opts.delete(:scope)
  self.slug_incremental = opts.delete(:incremental)
  self.slug_updatable = opts.delete(:updatable)
  validates_uniqueness_of :slug, scope: slug_scope
end