7
app/controllers/counts_controller.rb
Normal file
7
app/controllers/counts_controller.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class CountsController < ApplicationController
|
||||||
|
respond_to :xml, :json
|
||||||
|
|
||||||
|
def posts
|
||||||
|
@count = Post.fast_count(params[:tags])
|
||||||
|
end
|
||||||
|
end
|
||||||
1
app/views/counts/posts.json.erb
Normal file
1
app/views/counts/posts.json.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"counts": {"posts": <%= @count %>}}
|
||||||
6
app/views/counts/posts.xml.erb
Normal file
6
app/views/counts/posts.xml.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<counts>
|
||||||
|
<posts>
|
||||||
|
<%= @count %>
|
||||||
|
</posts>
|
||||||
|
</counts>
|
||||||
@@ -81,6 +81,11 @@ Danbooru::Application.routes.draw do
|
|||||||
get :index_all
|
get :index_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
resources :counts do
|
||||||
|
collection do
|
||||||
|
get :posts
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :delayed_jobs, :only => [:index]
|
resources :delayed_jobs, :only => [:index]
|
||||||
resources :dmails do
|
resources :dmails do
|
||||||
collection do
|
collection do
|
||||||
|
|||||||
Reference in New Issue
Block a user