Comment on Passing Arrays and Nested Params to url_for in Rails by Lon

Mon, 05 Mar 2007 00:10:38 -0800

Great work. I had one small tweak to add. The original Rails code would strip out paramenters that had a nil value.

One small tweak in your code in the to_query_string returns this behaviour.

elements += process_pair(CGI.escape(key.to_s), value) unless value.nil?

instead of:

elements += process_pair(CGI.escape(key.to_s), value)

But as I see you seem to need this functionality.

I would definitely prefer to see the original behaviour preserved to keep urls cleaner.