2017-09-04 77 views
0

甲形式靶向結果頁面:添加參數至搜索表單用於持久性

<%= form_tag results_interventos_path do %> 
     From: <%= date_select :intervento, :from, { order: [:day, :month, :year], default: Date.today-31, start_year: Time.now.year-1, end_year: Time.now.year, datetime_separator: "&nbsp;" } %> 
     To: <%= date_select :intervento, :to, { order: [:day, :month, :year], default: Date.today-30, start_year: Time.now.year-1, end_year: Time.now.year, datetime_separator: "&nbsp;" } %> 
     <%= collection_select(:intervento, :invoicestate_id, Invoicestate.all, :id, :nome, prompt: "tutti") %> 

結果路由到一個分頁(與will_paginate)目前定義爲頁面:

post :results 

目標:在URL中維護搜索參數,以便從結果頁面採取的任何操作可以返回到由:back符號定義的鏈接

回答

0

with prope R路徑,這是解決:

get :results 

形式也應該相應地指向正確的方法

<%= form_tag results_interventos_path, method: :get do %> 

否則後嘗試。