# Link\_to

**URL:** <https://www.ruby-forum.com/t/link-to/130430>\
**Category:** Rails\
**Created:** [February 28, 2008, 5:56am UTC](https://www.ruby-forum.com/t/link-to/130430 "2008-02-28T05:56:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [February 28, 2008, 5:56am UTC](https://www.ruby-forum.com/t/link-to/130430/1 "2008-02-28T05:56:05Z")

</div>

I have an edit\_func\_spec\_ui.rhtml file in the controller  
popup\_controller:

| Edit Functional Specification |
| --- |
| \<%= text\_area "ci\_content", "functional\_spec", "cols" =\> 120, "rows" =\> 5 %\> |

| \<%= link\_to ( "Save", {:controller =\> :ci, :action =\> :edit\_ci\_functional\_spec, :ci =\> @ci, :method =\> 'post'}, {'class' =\> 'itilbuttonlink1'})%\> | \<%= link\_to ( "Cancel", {:controller =\> :ci, :action =\> :edit, :ci =\> @ci}, {'class' =\> 'itilbuttonlink1'})%\> |

The link “Save” calls an action edit\_ci\_functional\_spec in another  
controller ci\_controller:  
def edit\_ci\_functional\_spec  
@ci = Ci.find(params[:ci])  
@ci.content.functional\_spec= params[:ci\_content][:functional\_spec]  
@ci.content.save  
redirect\_to :action =\> ‘edit’, :ci =\> @ci  
end

But i’m not getting the value of params[:ci\_content][:functional\_spec]  
in the above action. Anyone please help me to solve this.

Thanks in advance  
Suneeta

---

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [February 28, 2008, 9:14am UTC](https://www.ruby-forum.com/t/link-to/130430/2 "2008-02-28T09:14:21Z")

</div>

> ‘itilbuttonlink1’})%\>  
> But i’m not getting the value of params[:ci\_content][:functional\_spec]  
> in the above action. Anyone please help me to solve this.

Why would it? Save is just a link and fuctional\_spec is a textfield  
elsewhere on the page. Sounds like you want a form instead.

Fred

---

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [February 29, 2008, 4:58am UTC](https://www.ruby-forum.com/t/link-to/130430/3 "2008-02-29T04:58:05Z")

</div>

Suneeta Km wrote:

> \<%= link\_to ( “Save”, {:controller =\> :ci, :action =\>  
> :edit\_ci\_functional\_spec, :ci =\> @ci, :method =\> ‘post’}, {‘class’ =\>  
> ‘itilbuttonlink1’})%\>

> @ci.content.functional\_spec= params[:ci\_content][:functional\_spec]  
> @ci.content.save  
> redirect\_to :action =\> ‘edit’, :ci =\> @ci  
> end
> 
> But i’m not getting the value of params[:ci\_content][:functional\_spec]  
> in the above action. Anyone please help me to solve this.
> 
> Thanks in advance  
> Suneeta

Where in the above link\_to method do you see yourself setting the  
params[:ci\_content][:functional\_spec]…

You are setting the params[:ci] (which you grab later but not the  
former)

hth

ilan

---

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [February 29, 2008, 12:19pm UTC](https://www.ruby-forum.com/t/link-to/130430/4 "2008-02-29T12:19:49Z")

</div>

> > \<%= link\_to ( “Save”, {:controller =\> :ci, :action =\>  
> > :edit\_ci\_functional\_spec, :ci =\> @ci, :method =\> ‘post’}, {‘class’ =\>  
> > ‘itilbuttonlink1’})%\>

You cannot post form variables without using form. It’ll be better to  
use form and submit button instead of links.

Thanks

---

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [May 3, 2008, 5:56am UTC](https://www.ruby-forum.com/t/link-to/130430/5 "2008-05-03T05:56:28Z")

</div>

Buttons are not customizable enough for me. I used something like that

link\_to “Submit”, 'javascript:document.forms[0].submit(); ',  
:class=\>“button”
