Skip to content

Instantly share code, notes, and snippets.

@diegorv
Created February 5, 2009 01:44
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 diegorv/58488 to your computer and use it in GitHub Desktop.
Save diegorv/58488 to your computer and use it in GitHub Desktop.
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class Poller
def self.call(env)
if env["PATH_INFO"] =~ /^\/poller/
@posts = Post.find(1, :select => "title")
[200, {"Content-Type" => "text/html"}, @posts.title]
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment