Ruby on rails 可以向rails 3中的所有http请求发送默认参数吗?
有没有办法向rails 3中的所有http请求发送默认参数?您可以使用rails。您可以设置所有基于url的方法将使用的默认选项。可以以散列的形式指定默认选项 您可以在您的Ruby on rails 可以向rails 3中的所有http请求发送默认参数吗?,ruby-on-rails,ruby,http,Ruby On Rails,Ruby,Http,有没有办法向rails 3中的所有http请求发送默认参数?您可以使用rails。您可以设置所有基于url的方法将使用的默认选项。可以以散列的形式指定默认选项 您可以在您的路线中。rb: YourApp::Application.routes.draw do scope defaults: {foo: 'bar'} do # requests to routes defined here will have params[:foo] set to 'bar' end en
路线中。rb
:
YourApp::Application.routes.draw do
scope defaults: {foo: 'bar'} do
# requests to routes defined here will have params[:foo] set to 'bar'
end
end
rails3中不推荐使用默认的\u url\u选项。@kannathasan check
这些类似的方法存在于v4.0.2:
中link@kannathasan签出在参数中设置区域设置的实现
YourApp::Application.routes.draw do
scope defaults: {foo: 'bar'} do
# requests to routes defined here will have params[:foo] set to 'bar'
end
end