# Simple text\_area problem

**URL:** <https://www.ruby-forum.com/t/simple-text-area-problem/124561>\
**Category:** Rails\
**Created:** [December 30, 2007, 9:09am UTC](https://www.ruby-forum.com/t/simple-text-area-problem/124561 "2007-12-30T09:09:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankit2584](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@ankit2584](https://www.ruby-forum.com/u/ankit2584)\
**Post date:** [December 30, 2007, 9:09am UTC](https://www.ruby-forum.com/t/simple-text-area-problem/124561/1 "2007-12-30T09:09:57Z")

</div>

Hello,

I have a table called templates and have three columns in it  
id of type int  
template\_name of type varchar  
template\_text of type text

I am getting the following error

undefined method `template\_text’ for #\<#Class:0x45ad828:0x45ad800\>

have been trying to figure out for a while now. looksa very very easy  
problem…  
Also if i want to load value in the text\_area when a template is  
selected from the select field what should i write in the :value of the  
text\_area

test

\<%form\_for  
:template,@template,:url=\>{:controller=\>“template”,:action=\>“submit\_tag”}  
do |t|%\>  
\<%=t.select(:id,Template.find(:all).collect{|tem|[tem.template\_name,tem.id]},{:prompt=\>"-Select  
a template"})%\>  
  
  
\<%=submit\_tag(‘Apply Template’, :name=\>“submit”)%\> &nbsp&nbsp&nbsp&nbsp  
\<%=link\_to (“Create  
Template”,{:controller=\>“template”,:action=\>“create\_template”})%\>  
&nbsp&nbsp&nbsp&nbsp  
\<%=link\_to(“Update  
Template”,{:controller=\>“template”,:action=\>“update\_template”,:id=\>t.id})%\>  
&nbsp&nbsp&nbsp&nbsp  
\<%=link\_to(“Update  
Template”,{:controller=\>“template”,:action=\>“delete\_template”,:id=\>t.id})%\>

\<%=t.text\_area(“template\_text”,:name=\>“textarea”,:cols=\>50,:rows=\>600)%\>  
\<%end%\>

Please help.

Thank you.

---

<div class="post-metadata">

**Author:** ![ankit2584](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@ankit2584](https://www.ruby-forum.com/u/ankit2584)\
**Post date:** [December 30, 2007, 11:23am UTC](https://www.ruby-forum.com/t/simple-text-area-problem/124561/2 "2007-12-30T11:23:39Z")

</div>

> \<%form\_for  
> :template,@template,:url=\>{:controller=\>“template”,:action=\>“submit\_tag”}  
> do |t|%\>  
> \<%=t.select(:id,Template.find(:all).collect{|tem|[tem.template\_name,tem.id]},{:prompt=\>"-Select  
> a template"})%\>  
>   
>   
> \<%=submit\_tag(‘Apply Template’, :name=\>“submit”)%\> &nbsp&nbsp&nbsp&nbsp  
> \<%=link\_to (“Create  
> Template”,{:controller=\>“template”,:action=\>“create\_template”})%\>  
> &nbsp&nbsp&nbsp&nbsp  
> \<%=link\_to(“Update  
> Template”,{:controller=\>“template”,:action=\>“update\_template”,:id=\>t.id})%\>  
> &nbsp&nbsp&nbsp&nbsp  
> \<%=link\_to(“Update  
> Template”,{:controller=\>“template”,:action=\>“delete\_template”,:id=\>t.id})%\>
> 
> \<%=t.text\_area(“template\_text”,:name=\>“textarea”,:cols=\>50,:rows=\>600)%\>  
> \<%end%\>
> 
> Please help.
> 
> Thank you.

Hi,  
Ok Got the solution… Took me some time…I had named the table as  
templates and controller and model as template. I just renamed the table  
to mailtemplates, controller and model to mailtemplate and it works now.
