Chen Log

陳洛格

AutoLink on ruby on rails

leave a comment »

Because the AutoLink on rails has removed in rails 3.1,

so if you have to use the function you must be install other gem: 「Rinku

 

Before you start to install the Rinku Gem,

you must install the Xcode app and agree the license.

then 

$ gem install rinku

 

  • Inserted require 'rinku' into the controller file
  • Inserted the following into the view file <% text = "Go to http://www.abc.com or email me at dude@abc.com" %> and <%= Rinku.auto_link(text, mode=:all, link_attr=nil, skip_tags=nil) %>

key those text on the view file:

auto_link('http://www.pokemon.com', :all, 'target="_blank"')

Reference this url:
https://github.com/vmg/rinku 
http://stackoverflow.com/questions/6418710/replacing-the-auto-link-method-in-ruby-on-rails-3-1

Advertisements

Written by chenagw

2014/04/21 at 00:40

Posted in Uncategorized

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: