Module: Slugable

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/slugable.rb

Instance Method Summary collapse

Instance Method Details

#create_slugObject



8
9
10
11
12
13
# File 'app/models/concerns/slugable.rb', line 8

def create_slug
  if !self.slug? && self.title
    slug = "#{self.title.split.join('-').downcase}"
    self.update_attributes(slug: slug)
  end
end