Skip to content

Instantly share code, notes, and snippets.

@amuino
Created November 30, 2010 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amuino/722028 to your computer and use it in GitHub Desktop.
Save amuino/722028 to your computer and use it in GitHub Desktop.
This code used to work, but breaks in 3.0.3
Something in rails 3.0.3 broke mysql2.
It seems to also break some other gems:
https://github.com/ProtectedMethod/restful_acl/issues/issue/9
html_escape(tweet.text).
gsub(/(http:\/\/[^ ]+)/i) do |m|
link = link_to_outside(image_tag('external_link.png', :alt => "original link"), m)
end.gsub(/@[a-z_0-9]+/i) do |m|
u = User.find_by_twitter_handle(m[1..-1])
u ? link_to_user(u) : m
end.gsub(/(#[a-z_0-9]+)/i) do |m|
"<span class='hashtag'>#{m}</span>"
end.html_safe
# --
# undefined method `visit_ActiveSupport_SafeBuffer' for #<Arel::Visitors::MySQL:0x105e24cc0>
# --
html_escape(tweet.text).
gsub(/(http:\/\/[^ ]+)/i) do |m|
link = link_to_outside(image_tag('external_link.png', :alt => "original link"), m)
end.gsub(/@[a-z_0-9]+/i) do |m|
u = User.find_by_twitter_handle(String.new(m[1..-1]))
u ? link_to_user(u) : m
end.gsub(/(#[a-z_0-9]+)/i) do |m|
"<span class='hashtag'>#{m}</span>"
end.html_safe
# --
# note the use of String.new, since to_s will not work
# --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment