Abhishek Srivastava
2007-Jul-04 05:17 UTC
passing nested hash in params, in pagination_links
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
http://127.0.0.1:3000/datatests/resultsbychartid?datatest[chartmajorid]=xyzcode1&datatest[chartminorid]=xyzcode2
I am getting
http://127.0.0.1:3000/datatests/resultsbychartid?datatest=chartmajoridxyzcode1chartminoridxyzcode2
Can someone please suggest a workaround for this?
Regards,
Abhi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Abhishek Srivastava
2007-Jul-04 05:19 UTC
passing nested hash in params, in pagination_links
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
http://127.0.0.1:3000/datatests/resultsbychartid?datatest[chartmajorid]=xyzcode1&datatest[chartminorid]=xyzcode2
I am getting
http://127.0.0.1:3000/datatests/resultsbychartid?datatest=chartmajoridxyzcode1chartminoridxyzcode2
This causes a NoMethodError due to having a nil object while trying get the
passed values.
Can someone please suggest a workaround for this?
Regards,
Abhi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---