mysql - How would you store a business's hours in the db/model of a Rails app? -
I am preparing a rail app that will open and store the closing hours for a business. Basically, I just thought of using a text data type and giving it a free form:
"Sunday to Friday from 9am to 5pm Saturday from 11am to 4pm on Sunday"
However, the requirements have been changed and I need to check hours against the current date & amp; Display an "open" or "off" in the time and view. Something like this:
class business & lt; ActiveRecord :: Base Diff is open? # Something like this ... time.None> Open_time & amp; Amp; Time. Now & lt; Close_time expiration
So what would be the best way to settle this in case of hours of storage for each day of the week? Is there just so much in business: open blocks (or whatever) near open? Should I Store The Day as String?
This was the subject of Ruby Learning recently - can be helpful :)
< / Div>
Comments
Post a Comment