I want to store all my url in readble utf8
class User < ActiveRecord::Base
require 'addressable/uri'
require 'idn'
include IDN
def service_url=(url)
url = Addressable::URI.parse Addressable::URI.unescape(url)
url.host = Idna.toUnicode url.host
super url.to_s
end
end
any hints for refactor开发者_JAVA百科ing or for more universal gems?
精彩评论