# REST-based controller using HEAD to test for exist?/status?

**URL:** <https://www.ruby-forum.com/t/rest-based-controller-using-head-to-test-for-exist-status/120102>\
**Category:** Rails\
**Created:** [November 13, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/rest-based-controller-using-head-to-test-for-exist-status/120102 "2007-11-13T19:35:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drew\_Wilson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ba8739/32.png) [@Drew\_Wilson](https://www.ruby-forum.com/u/Drew_Wilson)\
**Post date:** [November 13, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/rest-based-controller-using-head-to-test-for-exist-status/120102/1 "2007-11-13T19:35:41Z")

</div>

I’d like to add an API to my REST-based controller that indicates the  
existence of a resource (and maybe other status like the last time it  
was updated.)

If I understand REST correctly, this seems like a natural use of  
http’s HEAD method. I should be able to just add route for :conditions  
=\> {:method =\> :head} param, and implement a status or exist? method  
to my controller.

Why isn’t this generated when I create my scaffold-resource?

How do others solve this problem? Do you just test for head? in your  
show method?

I’m curious to know the best practice.

Thanks,

Drew
