如何正确地使用参数构建URI ?

时间:2021-02-24 19:33:14

I need to build URI for address like

我需要为像这样的地址构建URI

http://example.org/controller?param1=value1&param2=value2

with a controller path variable

有一个控制器路径变量

controller_path = example.org/controller

And an array with flexible size

和一个灵活尺寸的数组

params = {:param1 => 'value1', :param2 => 'value2'}

How to properly build URI by own class methods?

如何通过自己的类方法正确地构建URI ?

1 个解决方案

#1


3  

controller_path(:param1 => 'value1', :param2 => 'value2')

or

controller_path(params) # in your case

#1


3  

controller_path(:param1 => 'value1', :param2 => 'value2')

or

controller_path(params) # in your case