Forum: Ruby on Rails Keeping sql query in session hash

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Szymon N. (Guest)
on 2006-04-06 11:58

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 ( 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
This topic is locked and can not be replied to.