2013-06-20 2 views
0

Après avoir envoyé un formulaire, je souhaite stocker certaines des valeurs soumises dans ma nouvelle URL (vers la page à laquelle j'ai été redirigé).Rails afficher/stocker des valeurs dans l'URL

Par exemple:

www.someurl.com/myproject?limit=10 

J'ai essayé

patient_record_path(limit: 10) 

mais cela ne semble pas fonctionner

Je reçois l'erreur: Aucun résultat de l'itinéraire {: action => "show",: controller => "patient_record",: limit => 10}

EDIT: Alors je l'ai changé en

patient_record_path(id: 1, limit: 10) 

Cela rend cependant il ne présente pas ces valeurs à l'url

routes râteau

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 
+0

Ce qui ne fonctionne pas? limite = 10 n'est pas reportée? –

+0

Aucun itinéraire ne correspond {: action => "show",: controller => "patient_record",: limit => 10} –

+0

imprimez 'rake routes', et montrez-nous les routes pertinentes –

Répondre

0

utilisation "de params.merge" pour conserver les paramètres précédents. par exemple.

<%= link_to 'Link', params.merge({:per_page => 20}) %>

Questions connexes