# How do you validate the availability for a "block of time"?

**URL:** <https://discuss.rubyonrails.org/t/how-do-you-validate-the-availability-for-a-block-of-time/34943>\
**Category:** rubyonrails-talk\
**Created:** [October 2, 2008, 12:09am UTC](https://discuss.rubyonrails.org/t/how-do-you-validate-the-availability-for-a-block-of-time/34943 "2008-10-02T00:09:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [October 2, 2008, 12:09am UTC](https://discuss.rubyonrails.org/t/how-do-you-validate-the-availability-for-a-block-of-time/34943/1 "2008-10-02T00:09:21Z")

</div>

I'm building an "appointment time" application, where the user selects an appointment time through a datetime\_select field.

I'm trying to validate that the appointment time the user selects is available.

The appointment times are for 30 minutes each, so a user should not be able to create a new appointment time within 30 minutes of an existing appointment.

Do you know how to validate that in the Appintment model?

(e.g.

def validates\_available\_appointment\_time\_slot &nbsp;&nbsp;... end

)

Any ideas?

---

<div class="post-metadata">

**Author:** ![Jodi1](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@Jodi1](https://discuss.rubyonrails.org/u/Jodi1)\
**Post date:** [October 2, 2008, 12:33am UTC](https://discuss.rubyonrails.org/t/how-do-you-validate-the-availability-for-a-block-of-time/34943/2 "2008-10-02T00:33:26Z")

</div>

Bob -
