カウント値を送信したいのですが、RORでサムズアップの宝石を使用している投稿をカウントします。
今、私はjsonでカウントを送信したい、投票はdef showのポストアクションとして
def index
@posts = Post.all
respond_with(@posts) do |format|
format.json { render json: @post_names = {:post => @posts.as_json(:only=> [:content, :title]) } }
end
end
クライアント側でそのカウント値を表示したいので、jsonを使用してカウント値を送信したいと思います。