match "/favicon.ico" => "tools#favicon"
match "/:url" => "main#article", as: :article, constraints: DoesntMatch.new(path:
class ToolsController < ApplicationController
def favicon
data = File.open("public/favicon_test.ico", "rb").read
send_data(data, :filename => "favicon.ico", :type => "image/png")
end
end
class DoesntMatch
def initialize(options)
@options = options
end
def matches?(request)
@options.inject(true) { |m, (k,v)|
m && (request.send(k) !~ v)
}
end
end
match "/:url" => "main#article", as: :article, constraints: DoesntMatch.new(path: /^\/favicon\.ico/)