# Text datatype in ror

**URL:** <https://www.ruby-forum.com/t/text-datatype-in-ror/127537>\
**Category:** Rails\
**Created:** [January 30, 2008, 5:13am UTC](https://www.ruby-forum.com/t/text-datatype-in-ror/127537 "2008-01-30T05:13:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 30, 2008, 5:13am UTC](https://www.ruby-forum.com/t/text-datatype-in-ror/127537/1 "2008-01-30T05:13:54Z")

</div>

Hi

```
 Can anybody help me to check whether a text field is nil in ror.

```

I have to check  
params[:service\_desk\_attachment1][:attachment] is nil .But how.The  
attachment is a field in the postgres table.There after migration it is  
read as character varying

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 30, 2008, 9:03am UTC](https://www.ruby-forum.com/t/text-datatype-in-ror/127537/2 "2008-01-30T09:03:35Z")

</div>

Sijo Kg wrote:

> Hi
> 
> ```
> Can anybody help me to check whether a text field is nil in ror.
> 
> ```
> 
> I have to check  
> params[:service\_desk\_attachment1][:attachment] is nil .But how.The  
> attachment is a field in the postgres table.There after migration it is  
> read as character varying
> 
> Sijo

you can add before\_filter to your controller and check  
params[:service\_desk\_attachment1][:attachment].blank?

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 30, 2008, 2:11pm UTC](https://www.ruby-forum.com/t/text-datatype-in-ror/127537/3 "2008-01-30T14:11:06Z")

</div>

Thanks It worked
