I'm using an array to store a list of catagories that a product will belong
to. Since the number of catagories a product can belong to isn't set (could
be 1 or could be 10), I was going to use an array. Does that sound like an
appropriate use?

On Tue, Aug 17, 2010 at 6:49 AM, Marnen Laibow-Koser
<[email protected]>wrote:

> Robert Walker wrote:
> > Marnen Laibow-Koser wrote:
> >> Chris Mear wrote:
> >>> On 17 August 2010 03:35, madisonkel <[email protected]> wrote:
> >>>> My question is what type do you give the variable :preferences for the
> >>>> migration? In:
> >> But I'd worry more about why you're storing an array in the DB.  There
> >> are some legitimate use cases for it, but usually it's a sign that you
> >> need to do some more normalization of your DB schema.
> >
> > Sounds to me like the OP is looking for a "cheap" way to store a bit of
> > schema-less user preferences data in the database. This would be like
> > using a key/value store, but without the overhead of setting up and
> > using something like Redis.
>
> Looking at the original post again, I think I agree.
>
> >
> > IMHO this is a fine use case for serializing a hash or array into a
> > database column.
>
> Yes -- as long as it's really a question of flexible attributes, and not
> just of being too lazy to design a proper schema. :)
>
> > As long as the limitations and performance
> > considerations are well understood.
>
> Exactly.
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]
>  --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to