文字列内の URL を実行可能な URL に変換したい。例: str = "こんにちは、これは yahoo のリンクです: http://www.yahoo.com "
//in the view i have
<%= parse_description(r[:description]) %>
//in helper, i am splitting each word in the string and verifying if i have a string which
// contains http, if http is present then i am using link_to to make it a valid url:
def parse_description(str)
s = ""
str.split.each do |w|
a = w.include?("http") ? (link_to nil,"#{w}") : w
s += "#{a} "
end
end
文字列がビューに戻されると、リンクはクリックできなくなります。私は何を間違っていますか?