Topic: Store Business Hours

Hello! I wish to create store business hours. It will be very simple. I want to include the day of the week, an opening time and a closing time. Also have the options of closed. I just want the user to be able to setup this "weekly schedule" once and change it as needed themselves as I have no idea what holidays she takes off, and she isn't going to take the time to make a whole yearly schedule.

Can anyone guide my in the correct direction of how to accomplish this? I haven't done anything like it before and I just can't wrap my head around it at the moment.

Thank you,
Keil

Last edited by tuscanidream (2012-12-17 11:40:58)

Learning rails, one day at a time.

http://keilmiller.com

Re: Store Business Hours

I was daydreaming while at work today and figured it out.

Model
integer day
datetime start_time
datetime end_time
boolean closed

Using Date::DAYNAMES.zip((0..6).to_a) to convert the integer to the day name in a select box.

Using combined_time_select gem to help me make neat time select fields.

Using stamp gem to help parse the time out of the datetime fields.

Last edited by tuscanidream (2012-12-18 19:51:27)

Learning rails, one day at a time.

http://keilmiller.com