This case is mostly the same as the positional arguments case above, but it supports additional query parameters as the last argument
Methods
Public Instance methods
To avoid generating "localhost/?host=foo.example.com" we can‘t use this optimisation on routes without any segments
[ show source ]
# File actionpack/lib/action_controller/routing/optimisations.rb, line 122
122: def applicable?
123: super && route.segment_keys.size > 0
124: end
This case uses almost the same code as positional arguments, but add a question mark and args.last.to_query on the end, unless the last arg is empty
[ show source ]
# File actionpack/lib/action_controller/routing/optimisations.rb, line 116
116: def generation_code
117: super.insert(-2, '#{\'?\' + args.last.to_query unless args.last.empty?}')
118: end
[ show source ]
# File actionpack/lib/action_controller/routing/optimisations.rb, line 108
108: def guard_conditions
109: ["args.size == #{route.segment_keys.size + 1}"] +
110: UrlRewriter::RESERVED_OPTIONS.collect{ |key| "!args.last.has_key?(:#{key})" }
111: end