I don't think I am doing anything different... Do we need to code the web addresses to be hyperlinks?
yeah, i haven't added in a parser yet, so if you want to make a link, use HTML <a href="http://whatever">click here linky link</a>
no need for a parser. rails has a method "linkify" so like: <%= linkify comment.text %> instead of <%= comment.text %>
OK! I found it: (it's automatically available to you within a rails RHTML file, this is found in text_helper.rb)
# Turns all urls and email addresses into clickable links. The +link+ parameter can limit what should be linked.
# Options are :all (default), :email_addresses, and :urls.
#
# Example:
# auto_link("Go to http://www.rubyonrails.com and say hello to david@loudthinking.com") =>
# Go to http://www.rubyonrails.com and
# say hello to david@loudthinking.com
#
# If a block is given, each url and email address is yielded and the
# result is used as the link text. Example:
# auto_link(post.body, :all, :target => '_blank') do |text|
# truncate(text, 15)
# end
def auto_link(text, link = :all, href_options = {}, &block)
return '' if text.blank?
case link
when :all then auto_link_urls(auto_link_email_addresses(text, &block), href_options, &block)
when :email_addresses then auto_link_email_addresses(text, &block)
when :urls then auto_link_urls(text, href_options, &block)
end
end