Forum: Ruby on Rails How to handle MySQL data types SET and ENUM in the applicati

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.
Preben (Guest)
on 2006-05-07 19:47
(Received via mailing list)
Hi,

I wonder how I should use the SET and ENUM data types in my MySQL
database combined with a rails application.

This is my current _form.rhtml file for products:
-------------------------------------------------------------
<%= error_messages_for 'product' %>

|
<!--[form:product]-->
<p><label for="product_name">Name</label><br/>
<%= text_field 'product', 'name'  %></p>

<p><label for="product_collection">Collection</label><br/>
<%= text_field 'product', 'collection'  %></p>

<p><label for="product_statistics">Statistics</label><br/>
<%= text_field 'product', 'statistics'  %></p>

<p><label for="product_quality">Quality</label><br/>
</p>

<p><label for="product_sizes">Sizes</label><br/>
</p>

<p><label for="product_description_dk">Description dk</label><br/>
<%= text_area 'product', 'description_dk'  %></p>

<p><label for="product_description_de">Description de</label><br/>
<%= text_area 'product', 'description_de'  %></p>

<p><label for="product_description_gb">Description gb</label><br/>
<%= text_area 'product', 'description_gb'  %></p>

<p><label for="product_comment">Comment</label><br/>
<%= text_area 'product', 'comment'  %></p>

<p><label for="product_image">Image</label><br/>
<%= file_field 'product', 'image'  %></p>

<!--[eoform:product]-->
--------------------------------------------

Quality is ENUM-type and sizes are the SET-type...

Any ideas how to handle these (or change the DB to something more useful
for rails).
|




Thanks
Preben
Jeremy K. (Guest)
on 2006-05-07 22:08
(Received via mailing list)
On May 7, 2006, at 8:45 AM, Preben wrote:
> I wonder how I should use the SET and ENUM data types in my MySQL
> database combined with a rails application.

They are returned as strings.  Ticket 3011 by Will Sobel (http://
dev.rubyonrails.org/ticket/3011) has full support for MySQL enums.

jeremy
Preben H. (Guest)
on 2006-05-07 23:20
> They are returned as strings.  Ticket 3011 by Will Sobel (http://
> dev.rubyonrails.org/ticket/3011) has full support for MySQL enums.

Since I'm very new to rails - how can I use that patch!

On my own computer I'm running Linux (gentoo) - and in fact, can I use
this patch on a server which I don't have root-access to?


Thanks
Preben
This topic is locked and can not be replied to.