How do i validate if a datetime entered in the form has alre

I am creating a form to capture appointments for specialists and
members… the schema of the appointments table looks something like

id (integer)
specialist_id (integer)
member_id (integer)
description (string)
start_at (datetime)
duration (integer)

what i want to achieve is when trying to save a new appointment the
data should be validated to check if an appointment is already booked
for the specific specialist or member. in other words it should not
allow me to book duplicate appointments for a specialist or member.
any help would be highly appreciated.


Maybe you should do it in model, in save or initialize method.

Paweł Stawicki