Forum: Ruby on Rails passing nested hash in params, in pagination_links

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.
Fe42793e924c920c690440497807164b?d=identicon&s=25 Abhishek Srivastava (Guest)
on 2007-07-04 07:22
(Received via mailing list)
Hi all,

I am using autocomplete in a rhtml form
which means that i am getting the input as
params[:datatest][:chartmajorid]  in my controller.

I am then using this input as the criterion for a find condition and
displaying the results, which is working perfectly, except that I would
like to paginate the collection I am getting as result.

For this, I ofcourse need the original input as well(chartmajorid,
chartminorid etc. ) to be passed as parameters again.

<%= pagination_links(@datatest_pages, :params => {:datatest => {
:chartmajorid =>@datatest_chartmajorid,:chartminorid =>
@datatest_chartminorid }},:window_size => 9) %>

But somehow the nested hash is being flattened.

Instead of

I am getting

This causes a NoMethodError due to having a nil object while trying get
the passed values.

Can someone please suggest a workaround for this?

This topic is locked and can not be replied to.