# Upcase

**URL:** <https://www.ruby-forum.com/t/upcase/144501>\
**Category:** Rails\
**Created:** [July 30, 2008, 11:32am UTC](https://www.ruby-forum.com/t/upcase/144501 "2008-07-30T11:32:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![srijith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@srijith](https://www.ruby-forum.com/u/srijith)\
**Post date:** [July 30, 2008, 11:32am UTC](https://www.ruby-forum.com/t/upcase/144501/1 "2008-07-30T11:32:27Z")

</div>

Hi

I am having one form there around 30 text field is there.after  
submitting the form the details should be save in database in capital  
letter.  
i tried with CSS text-transform:uppercase;  
but in frontend it showing capital letter but in database it save in  
small letter is any one knows please help…

I NEED TO SAVE IN DATABASE WITH CAPITAL LETTER.

---

<div class="post-metadata">

**Author:** ![srijith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@srijith](https://www.ruby-forum.com/u/srijith)\
**Post date:** [July 30, 2008, 11:52am UTC](https://www.ruby-forum.com/t/upcase/144501/2 "2008-07-30T11:52:24Z")

</div>

before\_save do |record|  
record.field = record.field.upcase  
end

---

<div class="post-metadata">

**Author:** ![srijith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@srijith](https://www.ruby-forum.com/u/srijith)\
**Post date:** [July 30, 2008, 11:53am UTC](https://www.ruby-forum.com/t/upcase/144501/3 "2008-07-30T11:53:00Z")

</div>

Also, please only post once.

---

<div class="post-metadata">

**Author:** ![srijith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@srijith](https://www.ruby-forum.com/u/srijith)\
**Post date:** [July 30, 2008, 1:15pm UTC](https://www.ruby-forum.com/t/upcase/144501/4 "2008-07-30T13:15:45Z")

</div>

babu nair wrote:

> I NEED TO SAVE IN DATABASE WITH CAPITAL LETTER.

Google for [ActiveRecord before\_save]

---

<div class="post-metadata">

**Author:** ![srijith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@srijith](https://www.ruby-forum.com/u/srijith)\
**Post date:** [July 30, 2008, 1:20pm UTC](https://www.ruby-forum.com/t/upcase/144501/5 "2008-07-30T13:20:27Z")

</div>

babu nair wrote:

> i tried with CSS text-transform:uppercase;  
> but in frontend it showing capital letter but in database it save in  
> small letter is any one knows please help…
> 
> I NEED TO SAVE IN DATABASE WITH CAPITAL LETTER.

BTW you should not save anything in ALL CAPS. They are tacky, and will  
make your  
program look like an obsolete COBOL form-letter experience, courtesy of  
your  
friendly neighborhood government bureaucracy.

If you actually have a client requesting this incompetent feature, save  
them  
from themselves by storing the text the way the user entered it, (and  
don’t use  
CSS to transform it, because they won’t see their mistakes). Then  
display the  
text using a transformation.

If you transform and then save, your program will have bugs when your  
users  
enter ligated characters in titlecase, such as an Ae stuck together.

–  
Phlip
