【发布时间】:2025-12-05 06:30:01
【问题描述】:
提交表单后,我想将一些提交的值存储在我的新 url 中(到我被重定向到的页面)。
例如:
www.someurl.com/myproject?limit=10
我试过了
patient_record_path(limit: 10)
但这似乎不起作用
我收到错误: 没有路线匹配 {:action=>"show", :controller=>"patient_record", :limit=>10}
编辑:所以我把它改成了
patient_record_path(id: 1, limit: 10)
这会呈现但它不会将这些值显示到 url
搜索路线
patient_record_index GET /patient_record(.:format) patient_record#index
POST /patient_record(.:format) patient_record#create
new_patient_record GET /patient_record/new(.:format) patient_record#new
edit_patient_record GET /patient_record/:id/edit(.:format) patient_record#edit
patient_record GET /patient_record/:id(.:format) patient_record#show
PUT /patient_record/:id(.:format) patient_record#update
DELETE /patient_record/:id(.:format) patient_record#destroy
【问题讨论】:
-
什么不起作用? limit=10 没有被结转?
-
没有路线匹配 {:action=>"show", :controller=>"patient_record", :limit=>10}
-
打印'rake routes',并显示相关路线
-
试试 patient_record_path(1, :limit => 10)
-
那没用。将那条线放在控制器的末尾是否正确?
标签: ruby-on-rails session routing