head
![Wide documentation Importance_3](https://d2vfyqvduarcvs.cloudfront.net/images/importance_3.png?1349367920)
head(*args)
protected
Return a response that has no content (merely headers). The options argument is interpreted to be a hash of header names and values. This allows you to easily return a response that consists only of significant headers:
head :created, :location => person_path(@person)
It can also be used to return exceptional conditions:
return head(:method_not_allowed) unless request.post? return head(:bad_request) unless valid_request? render
![Default_avatar_30](https://www.gravatar.com/avatar/5340e8563c48213da91fded5908ca06d?default=http://apidock.com/images/default_avatar_30.png&size=30)
List of statuses
You can view a full list of statuses at http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/status_codes.rb.
head can be called with a symbol or a status code:
Using head with a symbol
head :length_required # 411 Length Required head :ok # 200 OK
Using head with a status code
head 404 # 404 Not Found
![Default_avatar_30](https://www.gravatar.com/avatar/46c25f2bf4599e093905235f98151472?default=http://apidock.com/images/default_avatar_30.png&size=30)
Updated list of statuses
The list of supported statuses is now in the layout & rendering rails guide:
http://guides.rubyonrails.org/layouts_and_rendering.html#the-status-option