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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---