2009年6月8日 星期一

[RoR] 好用的自動連結方法 auto_link

auto_link(text, *args, &block)

Turns all URLs and e-mail addresses into clickable links.
自動將網址或是E-mail轉成超連結

You can add HTML attributes to the links using :href_options.
你可以用:href_options來加入HTML 的超連結屬性

:href_options => { :target => '_blank' }

The :link option will limit what should be linked.
Possible values for :link are :all (default), :email_addresses, and :urls.
:link可以限制只有網址或是E-mail成為連結

If a block is given, each URL and e-mail address is yielded and the result is used as the link text.

Examples
ActionView::Helpers::TextHelper

Related Posts Plugin for WordPress, Blogger...