Sorry slight error there in the view code (it actually looks like):
  <%= link_to('next', {:params => params.merge('answer' => @answer, 
'page' =>
   object_pages.current.previous,)}) + ' ' if 
object_pages.current.previous %>

Chris wrote:
> I need some help with pagination and the link_to in the view.
> 
> I'm trying to include a hash in the pagination link_to params and it 
> keeps flattening out my hash.
> 
> Example:
> Here's my hash called @answer:
>   "answer"=>{"6"=>"9bf31c7ff062936a96d3c8bd1f8f2ff3",
>            "7"=>"6f4922f45568161a8cdf4ad2299f6d23"}
> 
> Here's the code in my view for my pagination link:
>   	<%= link_to('next', {:params => params.merge('answer' => @answer, 'page' => object_pages.current.previous,)}) + ' ' if 
> object_pages.current.previous %>
> 
> See how the link_to doesn't maintain the actual hash:
> <a 
> href="/student_portal/evaluate_exam/7?commit=Submit+Test&amp;answer=69bf31c7ff062936a96d3c8bd1f8f2ff376f4922f45568161a8cdf4ad2299f6d23&amp;page=2">next</a>&nbsp;
> 
> Anyone know how I can pass a hash intact through a link_to ?
> 
> Thanks a ton!


-- 
Posted via http://www.ruby-forum.com/.