fixes #742, #590: add new counts controller api

This commit is contained in:
r888888888
2013-06-07 16:32:36 -07:00
parent 093558bfbd
commit 2f2c892670
4 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
class CountsController < ApplicationController
respond_to :xml, :json
def posts
@count = Post.fast_count(params[:tags])
end
end

View File

@@ -0,0 +1 @@
{"counts": {"posts": <%= @count %>}}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<counts>
<posts>
<%= @count %>
</posts>
</counts>

View File

@@ -81,6 +81,11 @@ Danbooru::Application.routes.draw do
get :index_all
end
end
resources :counts do
collection do
get :posts
end
end
resources :delayed_jobs, :only => [:index]
resources :dmails do
collection do