Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. module ActiveSupport::Inflector
  2.  
  3. # Parameterize "Foo's and Charles's bar" into "foos-and-charles-bar"
  4. # instead of into "foo-s-and-charles-s-bar".
  5. def parameterize_with_apostrophe_removal(string, sep = '-')
  6. string = string.dup
  7. string.gsub!(%r{s's\b}i, 's')
  8. string.gsub!(%{'}, "")
  9. parameterize_without_apostrophe_removal(string, sep)
  10. end
  11. alias_method_chain :parameterize, :apostrophe_removal
  12.  
  13. end
Add Comment
Please, Sign In to add comment