From 7ce03db77884e21256ba8f1615ad8dd841b76b86 Mon Sep 17 00:00:00 2001 From: Luke Melia Date: Tue, 24 Jun 2008 22:50:14 -0400 Subject: Fixes optimised named routes generating question mark followed by nothing when provided an empty hash as the last argument. Signed-off-by: Michael Koziarski [#481 state:committed] --- actionpack/lib/action_controller/routing/optimisations.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller/routing/optimisations.rb') diff --git a/actionpack/lib/action_controller/routing/optimisations.rb b/actionpack/lib/action_controller/routing/optimisations.rb index 0fe836606c..894d4109e4 100644 --- a/actionpack/lib/action_controller/routing/optimisations.rb +++ b/actionpack/lib/action_controller/routing/optimisations.rb @@ -103,9 +103,10 @@ module ActionController end # This case uses almost the same code as positional arguments, - # but add an args.last.to_query on the end + # but add a question mark and args.last.to_query on the end, + # unless the last arg is empty def generation_code - super.insert(-2, '?#{args.last.to_query}') + super.insert(-2, '#{\'?\' + args.last.to_query unless args.last.empty?}') end # To avoid generating "http://localhost/?host=foo.example.com" we -- cgit v1.2.3