On 23 February 2010 21:33, sgallo1 <sgal...@gmail.com> wrote:
> Wondering what would be the best way to implement this.
>
> I need to store that an item occurs on a specific day of the week or
> everyday.
> Say in the model we have a title and a day of week.
> I was thinking doing a 0-7 in my model for the item representing the
> day of the week with zero being everyday.

You could store an seven-figure number and bitwise it to work out
whether a given day was on or off.

Or you could have a separate table for "days" and have a many_to_many
association with it, to get a "days" collection in your model.

Or you could use a recurrence rule, if you need more flexibility
(something like RiCal)

Any preference?

Michael

PS Using "zero" for "all" would not be very intuitive, as 0 is
normally used to indicate Sunday.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to