Guest User

Untitled

a guest
Feb 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. module NiceParam
  2. module InstanceMethods
  3. def to_param
  4. "#{id}-#{title.downcase.
  5. gsub("å","aa").
  6. gsub("æ","ae").
  7. gsub("ø","oe").
  8. gsub(/[^[:alnum:]]/,'-')}".
  9. gsub(/-{2,}/,'-')
  10. end
  11. end
  12. def self.included(receiver)
  13. receiver.send :include, InstanceMethods
  14. end
  15. end
Add Comment
Please, Sign In to add comment