I have a simple line of code: @keyword = u @keyword and rails is throwing me an exception that it's not a method:
undefined method 'u' for #<SiteController:0x007fe447774da8>
I am upgrading this app from Rails 2 to Rails 3. Was the url_encode method replaced by something else? It's hard to find documentation for it. I'm using the method in my controller.
Try URI::encode():
require 'open-uri'
@keyword = URI::encode(@keyword)
I think URI.escape() should also work <- deprecated in Ruby 1.9.2 apparently.
You can use CGI.escape instead of the above, not sure of the difference, if any.
And you can still use url_encode if you do the following:
require "erb"
include ERB::Util
@keyword = u(@keyword)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With