Created
January 28, 2009 03:14
-
-
Save eltiare/53795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def urlize_parameters(obj, prefix = '') | |
case obj | |
when Hash: obj.map { |k,v| urlize_parameters(v, prefix.blank? ? k : "#{prefix}[#{k}]")}.join('&') | |
when Array: obj.map { |v| urlize_parameters(v, "#{prefix}[]")}.join('&') | |
else "#{prefix}=#{obj}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment