Start Using Squish in Rails
Just a quick tip - how many times have you found yourself cleaning up strings (maybe user input?) by doing things like this:
1
|
|
and the like? You want to replace consecutive whitespace with single whitespace and remove beginning and trailing whitespace.
If you’re using rails, try squish
- squish. Note that squish removes newlines, so it may not be appropriate for every scenario, but it’s a generally very useful function.