Hi, I'm working on an app for a personal trainer, at the moment I've got a User class with STI for clients and trainers. The way I would like the appointments to work is from the trainers side they can create appointments by choosing a date, time, trainer and client. Then from the clients side they will have the ability to create/ request an appointment by choosing a date, time and themselves as the client, however this will need confirmation and which trainer will be assigned to the appointment from one of the trainers before the appointment can be completed.
I'm just unsure about the actual implementation of this at the moment I've got an appointment model with appointment_at as datetime, duration as integer, confirmed as boolean, client_id, trainer_id. It is working at the moment and saving appointments, but only from the trainers point, with the client appointment creation the trainer_id wont be entered into the database until its confirmed by the trainer. So I wondered is it possible and good practice to have conditional if statements in the appointments controller create action to check for user type and in the case of the client appointment creation allow the trainer_id to be nil until confirmed. Also what would be the best way to implement the trainer confirmation.
To have the whole thing looking more elegant I would like to have appointments displayed in a calendar, and I like the look of simple calendar, ideally being able to alter between day view of hours and week view of days would be the best way, is this possible with simple calendar?
Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.