Skip to content

Instantly share code, notes, and snippets.

@ruprict
Created May 4, 2012 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruprict/2594991 to your computer and use it in GitHub Desktop.
Save ruprict/2594991 to your computer and use it in GitHub Desktop.
Rails HEAD
curl -I http://localhost:3000/posts.json\?per_page\=20\&page\=1
10:00:32 web.1 | cache: [HEAD /posts.json?per_page=20&page=1] miss
10:00:32 web.1 |
10:00:32 web.1 |
10:00:32 web.1 | Started GET "/posts.json?per_page=20&page=1" for 127.0.0.1 at 2012-05-04 10:00:30 -0400
10:00:32 web.1 | Processing by V2::PostsController#index as JSON
10:00:32 web.1 | Parameters: {"per_page"=>"20", "page"=>"1", "event_id"=>"18545"}
10:00:32 web.1 |
10:00:32 web.1 | test: GET
def index
Rails.logger.info "test: #{request.method}" # This will return GET
if head? # This will return FALSE
...do head stuff
else
... do get stuff
end
end
resources :posts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment