Sha256: 5338301b18e35cb4cf954ab0200c07f373dcf331c11c089132ef979ef6d015bf

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

require "sinatra/base"

module Monocle
  class Server < Sinatra::Base
    post "/:type/:id" do
      begin
        params[:type].classify.constantize.find(params[:id]).view!
        ActiveRecord::Base.clear_active_connections!
        "o_0 +1"
      rescue ActiveRecord::RecordNotFound
        "o_0"
      end
    end

    get "/:type/:id" do
      content_type("image/gif")
      File.open(File.join(File.dirname(__FILE__), "..", "transparent.gif"))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monocle-0.1.0 lib/monocle/server.rb