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>
|
||||
Reference in New Issue
Block a user