Keeping sql query in session hash

Hi!

Could it be somehow dangerous or is not generally recommended?

I’m having troubles with paginating search results. I don’t want to
resend conditions parameters in every pagination link (next, previous,
pagination_links) and build query every time the search action is
executed. I can’t be sure which conditions will be present and which
not, so it all could get quite complicated. I just thought that i could
save sql query into session hash and if user clicks one of pagination
links (so it will be request.get) i just use stored query, if user has
just filled the form (request.post) i just build the query and store it
into session hash.

Can i do it like this? Or is there better way for using pagination with
conditions?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs