Cleanup ActiveRecord field

Posted by Beer Brother on Stack Overflow See other posts from Stack Overflow or by Beer Brother
Published on 2010-04-05T23:43:46Z Indexed on 2010/04/05 23:53 UTC
Read the original article Hit count: 238

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails