# Disabling rails changing the case of data

**URL:** <https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856>\
**Category:** Rails\
**Created:** [July 12, 2008, 6:04am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856 "2008-07-12T06:04:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 12, 2008, 6:04am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/1 "2008-07-12T06:04:47Z")

</div>

I’m trying to populate data from a database and assign the data to  
form.label. The data in the database is in all caps but when it is  
displayed in my browser it is first character upper and the rest  
lower. How can I keep the text in uppercase?

---

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 12, 2008, 12:25pm UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/2 "2008-07-12T12:25:56Z")

</div>

Daniel wrote:

> I’m trying to populate data from a database and assign the data to  
> form.label. The data in the database is in all caps but when it is  
> displayed in my browser it is first character upper and the rest  
> lower. How can I keep the text in uppercase?

Hi Daniel,

What is the relevant view code?

Peace,  
Phillip

---

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 14, 2008, 12:04am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/3 "2008-07-14T00:04:27Z")

</div>

@subjects = Subjects.find(:all, :conditions =\> “category\_id =  
#{category.id}”)  
for subject in @subjects  
\<%=f.check\_box(subject.id)%\>\<%=f.label(subject.name)%\>\<  
%=f.hidden\_field(subject.category\_id)%\>

```
    end

```

##### 

The f.label(subject.name) will change the case (which is in all caps)  
to first letter upper and the rest lower. What I’m displaying are  
acronyms and they need to be capitalized but the other words need  
their case to remain the same (upper and lower). So basically I want  
rails to ignore the case and just display it as is.

Thanks for your response,  
-Daniel

On Jul 12, 6:25 am, Phillip K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 14, 2008, 12:47am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/4 "2008-07-14T00:47:08Z")

</div>

That was it! I’m currently learning Rails so most of my work is from  
a book right now. I have another question…I’m having a hard time  
learning how to work with checkboxes and I would like to be able to  
verify if a check box is checked after submitting a form and then to  
search the database using the index “id” of the checked box. Could  
you give me some direction using ‘pseudo code’ on how I can do this in  
Rails?

On Jul 13, 6:12 pm, Phillip K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 14, 2008, 12:12am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/5 "2008-07-14T00:12:40Z")

</div>

Daniel wrote:

> The f.label(subject.name) will change the case (which is in all caps)  
> to first letter upper and the rest lower. What I’m displaying are  
> acronyms and they need to be capitalized but the other words need  
> their case to remain the same (upper and lower). So basically I want  
> rails to ignore the case and just display it as is.

I guess the easiest answer is a simple question: must you use f.label?  
Why not just output the text with h?  
I hope this is not an obvious question. I have never actually used  
label.

Phillip

---

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 14, 2008, 1:33am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/6 "2008-07-14T01:33:33Z")

</div>

Daniel wrote:

> That was it! I’m currently learning Rails so most of my work is from  
> a book right now. I have another question…I’m having a hard time  
> learning how to work with checkboxes and I would like to be able to  
> verify if a check box is checked after submitting a form and then to  
> search the database using the index “id” of the checked box. Could  
> you give me some direction using ‘pseudo code’ on how I can do this in  
> Rails?
> 
> On Jul 13, 6:12ï¿½pm, Phillip K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Hi Daniel,

Here’s a quick example of working with a checkbox.

in a view file (I am using the Malline plugin for views, so you’ll need  
to write this as ERb):

form\_remote\_tag(:url =\> {:controller =\> :welcome, :action =\> :check},  
:update =\> :check\_div) do  
\_check\_box\_tag :my\_check, ‘true’  
\_submit\_tag ‘Check’  
end

div.check\_div! do  
end

Then in the controller:

def check  
render :text =\> (params[:my\_check] ? params[:my\_check] == ‘true’ :  
‘Not present’)  
end # check

Notice that I’m checking to see if my\_check is part of params. This is  
because HTML forms do not send checkboxes that are not checked. This may  
not be the case for FormBuilder, though. So it might depend on whether  
you are using form\_for or just form\_tag (or the remote counter parts).

Peace,  
Phillip

---

<div class="post-metadata">

**Author:** ![daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@daniel](https://www.ruby-forum.com/u/daniel)\
**Post date:** [July 14, 2008, 12:51am UTC](https://www.ruby-forum.com/t/disabling-rails-changing-the-case-of-data/142856/7 "2008-07-14T00:51:49Z")

</div>

Here’s what I have so far:

def enter\_subjects  
for selected\_subject in params[:tutor\_subjects]  
if selected\_subject == 1  
@tutor\_subject = TutorSubjects.new()  
@tutor\_subject.tutor\_id = Tutors.find(:id, :conditions =\>  
“email = #session[:email]”)  
@tutor\_subject.subject = Subjects.find(:name, :conditions =\>  
“id = #selected\_subject”)  
if @tutor\_subject.sav  
redirect\_to :action =\> “tutor\_city”  
else  
flash[:notice] = ‘Tutor was not created successfully.’  
redirect\_to :action =\> “tutor\_city”  
end  
end  
end  
end
