# Newbie question: How to get an object in the Controller from

**URL:** <https://www.ruby-forum.com/t/newbie-question-how-to-get-an-object-in-the-controller-from/103221>\
**Category:** Rails\
**Created:** [May 3, 2007, 3:04am UTC](https://www.ruby-forum.com/t/newbie-question-how-to-get-an-object-in-the-controller-from/103221 "2007-05-03T03:04:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anupam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9de053/32.png) [@anupam](https://www.ruby-forum.com/u/anupam)\
**Post date:** [May 3, 2007, 3:04am UTC](https://www.ruby-forum.com/t/newbie-question-how-to-get-an-object-in-the-controller-from/103221/1 "2007-05-03T03:04:38Z")

</div>

Hi,  
I’m trying to pass an object from the View to the controller as a  
hidden field. And am confused about a few things.

For a hidden field, how do I pass a complete object to the  
controller?  
For example, I have an object of type Issue, what should the second  
argument be in the following:

\<%= hidden\_field(“issue”, ?, “value” =\> @issue) %\>

Is that even possible?

Secondly, how would I access this object in the controller?  
params[:issue][:id] doesn’t work.

Someone suggested I should put the object in the session. How do I  
put and retrieve variables from the session?

Any help would be appreciated.

Thanks,  
Anupam.

---

<div class="post-metadata">

**Author:** ![anupam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9de053/32.png) [@anupam](https://www.ruby-forum.com/u/anupam)\
**Post date:** [May 3, 2007, 3:22am UTC](https://www.ruby-forum.com/t/newbie-question-how-to-get-an-object-in-the-controller-from/103221/2 "2007-05-03T03:22:39Z")

</div>

Fields are HTML not Ruby. They only hold text. You can do @issue.id  
then the controller is going to have to use .to\_i to get an integer  
and Issue.find\_by\_id to locate the object.

Michael
