Cleanup ActiveRecord field
- by Beer Brother
I have model Article it has field title with some text that may contain some "magic" patterns. In some cases i need to process text in title and other cases i don't, but in last case i need to get string w/o that patterns.
For example i have title value like "Something **very** interesting" and when i call @article.title i need to get cleaned up string like "Something very interesting", but when i call @article.title_raw i need get original string.
The problem also is that i have working application and i cannt do "revolution" but what way to go...
--
Excuse me for my bad English.