I am trying to remove all
's in my model with the following method :
def about_us_sans_spaces
self.about_us = replace(self.about_us, " ", " ")
end
Except! it turns out 'replace' isn't a method in rails. How would you remove the
's?
Mind you, I have already tried sanitized, simple_format. My view looks like this right now:
= truncate(sanitize(simple_format(organization.about_us_sans_spaces), :tags => ''), 125).titleize
def about_us_sans_spaces
self.about_us.gsub!(" ", "")
end
Edit: Note that gsub() also accepts regex, so you can catch all instances regardless of capitalization like so:
about_us.gsub(/ /i,"")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With