I use Ruby on Rails, and I store working hours as follows:
CREATE TABLE "business_hours" (
"id" integer NOT NULL PRIMARY KEY,
"business_id" integer NOT NULL FOREIGN KEY REFERENCES "businesses",
"day" integer NOT NULL,
"open_time" time,
"close_time" time)
(which appeared from the stream:
Saving working hours in the database )
Now I want to pull out the clock for each day of the week and display it, and I'm trying to find the best (or at least good) way.
Should I just have a helper method that goes through getting days (from 0..6) for a given business identifier and assigns it a variable for the associated day? I feel that there should be a better way - with an array or something like that, but it hurts me to think about it, because I also have a form of "choose where you can edit any of the watches for this business."
Thanks for any guidance!