Disabling rails changing the case of data

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?

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

@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. [email protected]

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. [email protected]

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

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. [email protected]

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs