Ruby 1.9
I’m trying to do a trivial operation in Ruby. I want to change each element of array by adding some data to its property title as a prefix.
def my_proc
@data = SomeTable.all
@data.each { |d| 'my_title___'<< pt.title }
end
What did I do wrong?
UPDATE: I need to append some value to pt.title as a prefix. If pt.title == “some title” then after appending it must be “my_title___some title”. Of course, as a result it must be an array of objects with changed titles.
How do I do that?
Do you mean this?