# Mysql string

**URL:** <https://www.ruby-forum.com/t/mysql-string/113027>\
**Category:** Rails\
**Created:** [August 26, 2007, 12:09pm UTC](https://www.ruby-forum.com/t/mysql-string/113027 "2007-08-26T12:09:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [August 26, 2007, 12:09pm UTC](https://www.ruby-forum.com/t/mysql-string/113027/1 "2007-08-26T12:09:46Z")

</div>

hi, hope u’r all having a good week ahead -

does anyone know how to modify / change existing text in a db?

with the code

@foods = Food.find(:all)  
food\_rows = @foods.collect(&:fruit)  
food\_rows.each |r|  
r.gsub(“really”, “”)  
end

i get a good end result (if the data was

Food.find(1).fruit = “we really need apples”  
Food.find(2).fruit = “we really need kiwis”  
Food.find(3).fruit = “we really need oranges”

that is, after the code, i get

“we need apples”  
“we need kiwis”  
“we need oranges”

which is good, but that is the program’s output. i was wondering whether  
someone knew a way to do this, that modifies the data in the database  
(mysql).

thanks for the hassle
