Link_to with pagination


#1

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 => ‘answer’ => @answer,
params.merge(‘page’ => object_pages.current.previous,)}) + ’ ’ if
object_pages.current.previous %>

See how the link_to doesn’t maintain the actual hash:
next 

Anyone know how I can pass a hash intact through a link_to ?

Thanks a ton!


#2

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:
next 

Anyone know how I can pass a hash intact through a link_to ?

Thanks a ton!


#3

On Jun 6, 2006, at 10:31 PM, Chris wrote:

keeps flattening out my hash.


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

Wrong mailing list

http://lists.rubyonrails.org/mailman/listinfo/rails