Simple Rails Question

Hi, I have a few simple rails questions:

Does the check_box_tag map to an int or to a boolean field within the
database?

Thanks in advance,

-Conrad

check_box will use a 1 or 0 for checked/unchecked. The db field can be
a char, int or boolean (if the db supports it).

In a view displaying products for example:

<%= check_box(‘product’, ‘available’) %>

where ‘available’ is a field in the ‘products’ table.

Hope this helps,

Steve

Hi, what’s difference between using check_box and check_box_tag? Just
curious as to what one should use in development. Well, I must go and
thanks for the information.

-Conrad

check_box is used to map to a model attribute (like ‘available’ in the
‘product’ model)

check_box_tag creates a checkbox from the options you give.

Steve

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