class PostsController < ApplicationController # POST /posts # POST /posts.json def create @post = Post.new(params[:post]) respond_to do |format| if @post.save # send a value of 1 to the 'Posts Created' metric with a timestamp of now StatsMix.track('Posts Created', 1) format.html { redirect_to @post, :notice => 'Post was successfully created.' } format.json { render :json => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.json { render :json => @post.errors, :status => :unprocessable_entity } end end end # DELETE /posts/1 # DELETE /posts/1.json def destroy @post = Post.find(params[:id]) @post.destroy StatsMix.track('Deleted Posts', 1) respond_to do |format| format.html { redirect_to posts_url } format.json { head :no_content } end end end