# Please help - I have couple of doubts

**URL:** <https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296>\
**Category:** Rails\
**Created:** [December 27, 2007, 1:29pm UTC](https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296 "2007-12-27T13:29:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atulxxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@atulxxx](https://www.ruby-forum.com/u/atulxxx)\
**Post date:** [December 27, 2007, 1:29pm UTC](https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296/1 "2007-12-27T13:29:40Z")

</div>

Hello,

I have following doubts and have spent many days trying to crack them  
without luck, please help :

1. I have a form with pure text fields at the top and a table with  
multiple rows with data derived from many objets of a class below that.  
I want to provide a link in each row which takes me to a new form. I  
can pass the id of each row via the link\_to tag and read the value  
successfully in the next form.

But how do I include the value of the text boxes in each row ?

1. Can I send an object with several attibutes in the link-to tag, say  
the object name is ‘book’, then how do i read it as an object in the  
next form, params[:book] didnot work.

2. Is there a way to send a hash via the link\_to tag ?

Thanks

atul

---

<div class="post-metadata">

**Author:** ![atulxxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@atulxxx](https://www.ruby-forum.com/u/atulxxx)\
**Post date:** [December 27, 2007, 2:00pm UTC](https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296/2 "2007-12-27T14:00:59Z")

</div>

On Dec 27, 2007, at 6:29 AM, Atul G. wrote:

> can pass the id of each row via the link\_to tag and read the value  
> Thanks
> 
> atul

I have a somewhat similar situation in which I have a list of  
“headers”. For example’s sake, lets call it a list of people and the  
header includes a name and a date of birth. When the header is  
clicked, I display a form that is populated with details about the  
person. I do this with a variation of link\_to\_remote. Basically,  
you make an AJAX call to the server passing the id of the object you  
want to operate on. The controller action then gathers all the data  
necessary and renders a partial, which is displayed in the area you  
want it. If you use link\_to\_remote “properly”, then one of the  
parameters is :update =\> “dom\_id\_of\_element\_to\_update” and all you  
have to do in the controller is a render :partial. I, however, being  
the renegade (or idiot, as the case may be) that I am, call a  
Javascript function which makes the AJAX call and the controller uses  
render :update to refresh the element. [Ooh, I can hear all the boos  
now. :)]

That should get you going. If not, feel free to ask more.

Peace,  
Phillip

---

<div class="post-metadata">

**Author:** ![atulxxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@atulxxx](https://www.ruby-forum.com/u/atulxxx)\
**Post date:** [December 27, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296/3 "2007-12-27T15:19:37Z")

</div>

Thanks for a solution Phillip, anyway, is there a way to include more  
than one value in the link\_to tag ?

atul

---

<div class="post-metadata">

**Author:** ![atulxxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@atulxxx](https://www.ruby-forum.com/u/atulxxx)\
**Post date:** [December 28, 2007, 12:50pm UTC](https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296/4 "2007-12-28T12:50:26Z")

</div>

Hi Phillip K.,

Thanks a lot, that solved my problem.

atul

---

<div class="post-metadata">

**Author:** ![atulxxx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@atulxxx](https://www.ruby-forum.com/u/atulxxx)\
**Post date:** [December 27, 2007, 4:09pm UTC](https://www.ruby-forum.com/t/please-help-i-have-couple-of-doubts/124296/5 "2007-12-27T16:09:40Z")

</div>

On Dec 27, 2007, at 8:19 AM, Atul G. wrote:

> Thanks for a solution Phillip, anyway, is there a way to include more  
> than one value in the link\_to tag ?

Well, you can do basically the same thing with link\_to as you do with  
redirect\_to, and that is

\<%= link\_to “My link”, :controller =\> ‘my\_controller’, :action =\>  
‘my\_action’, :id =\> 1, :my\_param\_1 =\> ‘good-bye’, :my\_param\_2 =\>  
‘cruel world!’ %\>

and that will result in a url like

[http://localhost:3000/my\_controller/my\_action/1?my\_param\_1=good-](http://localhost:3000/my_controller/my_action/1?my_param_1=good-)  
bye&my\_param\_2=cruel+world%21

If you don’t like fat URLs, the other option is to use :method  
=\> :post, which I _think_ you can do with link\_to. I’ll leave  
figuring that part out to you 🙂

Peace,  
Phillip
