2012-03-25 6 views

답변

4

이렇게하려면 auto_link 메서드를 사용할 수 있습니다.

auto_link("Go to http://www.rubyonrails.org and say hello to [email protected]") 
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and 
#  say hello to <a href=\"mailto:[email protected]\">[email protected]</a>" 

는,이 내장되어 레일 3.1 이하 아무것도 경우 그렇지 않으면 당신은 rails_autolink gem

+0

감사를 사용해야합니다! 이것은 효과가 있었다. Rails 3.1에서 제거한 이유를 알고 있습니까? 그것은 매우 유용하게 보입니다. – LennonR

+1

Rails 릴리스주기가 허용하는 것보다 더 자주 업데이트를 허용하는 것 같습니다. [github에서 커밋하기] (https://github.com/rails/rails/commit/81cfbf4146d3c5a58054b64112b8ce196f2fc061#actionpack/lib/action_view/helpers/text_helper.rb) : "불행히도이 방법은 올바르게 보안하기가 극히 어렵습니다. 방법은 방탄이다. 우리가 레일보다 더 빠른 릴리즈주기를 취한다. 그래서 우리는 그것을 보석으로 옮겼다. 기능이 필요할 경우 보석을 사용하라! :-) " –

관련 문제