Guest User

Untitled

a guest
Jul 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. # Instead of the standard composition, convert everything
  2. # non-alpha and non-digit to dash and squeeze
  3. class String
  4. def identify
  5. if Mongoid.parameterize_keys
  6. gsub(/[^a-z0-9]+/, ' ').strip.gsub(' ', '-')
  7. else
  8. self
  9. end
  10. end
  11. end
Add Comment
Please, Sign In to add comment