The only major concern with is how you''re going to efficiently perform
queries for shows occurring on particular dates. If you stored the
dates as a comma-separated list of strings, you could make these kinds
of queries a bit more efficient:
class Show
def for_date(date)
# assuming trailing commas...
find(:all, :conditions => ["date LIKE
''%?,%''", date.strftime("%Y/
%m/%d")])
end
end
You''re sorta screwed if you want to find shows within a date range
though. Also, you have to load and re-save the entire column just to
add or remove a date -- this is probably ok if there are less than a
hundred dates...
Using a many-to-many isn''t THAT hard. You get a lot of power with it
-- and the amount of glue code you need to write should be minimal.
In this case it seems to be the cleaner solution...
On Apr 21, 10:06 pm, Chris Carter
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi all!
> I have a model (Show) than can have an unknown number of dates. And a
> date can have an unknown number of shows. Making a Date model seems
> icky, espicially since I would have to probably write a lot of glue code
> to get the many-many to work easily. I was thinking maybe storing a
> Marshaled array of Time objects in a text field, but that isn''t
very
> clean either... Any Ideas?
>
> --
> Posted viahttp://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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---