Module: Gluttonberg::Content::SlugManagement::InstanceMethods

Defined in:
lib/gluttonberg/content/slug_management.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) slug=(new_slug)



26
27
28
29
30
31
# File 'lib/gluttonberg/content/slug_management.rb', line 26

def slug=(new_slug)
  #if you're changing this regex, make sure to change the one in /javascripts/slug_management.js too
  # utf-8 special chars are fixed for new ruby 1.9.2
  new_slug = new_slug.downcase.gsub(/\s/, '_').gsub(/[\!\*'"″′‟‛„‚”“”˝\(\)\;\:\.\@\&\=\+\$\,\/?\%\#\[\]]/, '')
  write_attribute(:slug, new_slug)
end