jeudi 17 janvier 2019

DRY Pagination for complex POST action

I implemented a stats panel in my current project. It's possible to select people by specific objects (different Models) which allows you for example to search for people which belong to in Group B, Organisation A and Flag A (Group B ∩ Organisation A ∩ Flag A; btw. it's possible to select multiple objects of the same class).

This makes my post-request very complex and has many parameters (sorting, fields, ...). The result is then displayed via jQuery in a special div.

What would be the best practice to make my project more flexible in order to support a page_id via the rails routes.

First I thought about hashing all the parameters in order to support absolute urls without form fields and then adding the page number (e.g. /stats_search/param_hash/2 ).

Well, to be short: I want a DRY and clean solution (without passing all my form fields again) in order to support multiple pages for a specific POST request (group selection) via GET requests.

Aucun commentaire:

Enregistrer un commentaire