search for: names_links

Displaying 1 result from an estimated 1 matches for "names_links".

2010 Mar 03
0
Using gsub to replace text with link from database
...to the players. @full_text = params[:q] @full_text_array = @full_text.scan(/([A-Z]+[a-zA-Z]* [A-Z]+[a-zA-Z]*)/) @full_text_array.each_with_index do |original_name, i| @full_text.gsub!(original_name.to_s, @new_link_array[i]) end results = @full_text.scan(/([A-Z]+[a-zA-Z]* [A-Z]+[a-zA-Z]*)/) names_links = {} results.each do |name| unless names_links[name] names_links[name] = method_to_construct_link_for_name(name) end end names_links.each_pair do |name, link| @full_text.gsub!(name, link) end The results are not consistent. I was wondering if somebody could help me out. -A -- Poste...