替换Ruby on Rails 3.1中的'auto_link'方法 [英] Replacing the 'auto_link' method in Ruby on Rails 3.1

查看:50
本文介绍了替换Ruby on Rails 3.1中的'auto_link'方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ruby on Rails 3.0.7,并且我知道在3.1版本中将不再有auto_link方法(请参见actionpack/lib/action_view/helpers/text_helper.rb (针对RoR 3.1).

I am using Ruby on Rails 3.0.7 and I know that in the 3.1 version there won't be the auto_link method anymore (see the actionpack/lib/action_view/helpers/text_helper.rb for RoR 3.1).

还有另一种方法来具有与旧的auto_link方法相似的功能吗?也就是说,如何在Ruby on Rails 3.1中替换该有用的方法?

Is there another way to have similar functions as the old auto_link method? That is, how can I replace that useful method in Ruby on Rails 3.1?

BTW :为什么将删除auto_link方法?

BTW: why will the auto_link method will be removed?

推荐答案

Rinku -替代Rails 3.1 auto_link.

自动链接功能已从Rails 3.1中删除,而是作为独立的宝石提供, rails_autolink .您可以选择使用Rinku.

Auto-linking functionality has been removed from Rails 3.1, and is instead offered as a standalone gem, rails_autolink. You can choose to use Rinku instead.

require 'rails_rinku'

rails_rinku包使用auto_link方法对Rails进行猴子修补,该方法模仿每个参数100%的原始参数.只是更快.

The rails_rinku package monkeypatches Rails with an auto_link method that mimics 100% the original one, parameter per parameter. It's just faster.

这篇关于替换Ruby on Rails 3.1中的'auto_link'方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆