# Passing same params through several controllers

**URL:** <https://www.ruby-forum.com/t/passing-same-params-through-several-controllers/123230>\
**Category:** Rails\
**Created:** [December 15, 2007, 5:40am UTC](https://www.ruby-forum.com/t/passing-same-params-through-several-controllers/123230 "2007-12-15T05:40:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@hsun](https://www.ruby-forum.com/u/hsun)\
**Post date:** [December 15, 2007, 5:40am UTC](https://www.ruby-forum.com/t/passing-same-params-through-several-controllers/123230/1 "2007-12-15T05:40:04Z")

</div>

Model Product  
…  
#has weight  
end

ProductController  
def list  
top = params[:top] #positive integer  
#select how many product based on weight from highest to lowest as  
much as ‘top’ element  
#for example: list?top=10, only list the top 10 heaviest product  
…  
end

def edit  
… #edit product  
… #redirect to list  
end

so in browser [http://localhost/product/list?top=10](http://localhost/product/list?top=10)  
i will get the top 10 heaviest product  
i edit on of the product  
then it will bounce back to list?top=10 instead of list

the question is: how can i maintain the params[:top] across several  
methods in 1 controller or several controllers?

Thank you

---

<div class="post-metadata">

**Author:** ![hsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@hsun](https://www.ruby-forum.com/u/hsun)\
**Post date:** [December 15, 2007, 8:51am UTC](https://www.ruby-forum.com/t/passing-same-params-through-several-controllers/123230/2 "2007-12-15T08:51:43Z")

</div>

Store in session variable

Sent from my iPhone
