Forum: Ruby on Rails Simple Rails Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Conrad T. (Guest)
on 2006-04-26 00:53
(Received via mailing list)
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
Stephen B. (Guest)
on 2006-04-26 01:12
(Received via mailing list)
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
Conrad T. (Guest)
on 2006-04-26 02:17
(Received via mailing list)
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
Stephen B. (Guest)
on 2006-04-26 02:36
(Received via mailing list)
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 topic is locked and can not be replied to.