example/app/controllers/posts_controller.rb in ab_panel-0.0.9 vs example/app/controllers/posts_controller.rb in ab_panel-0.1.0

- old
+ new

@@ -1,48 +1,39 @@ class PostsController < ApplicationController - track_action '[visits] post', :post => :id, :only => [ :show ] - - # GET /posts - # GET /posts.json def index @posts = Post.all respond_to do |format| - format.html # index.html.erb + format.html format.json { render json: @posts } end end - # GET /posts/1 - # GET /posts/1.json def show @post = Post.find(params[:id]) respond_to do |format| - format.html # show.html.erb + format.html format.json { render json: @post } end + + track_action '[visits] post', :post => :id end - # GET /posts/new - # GET /posts/new.json def new @post = Post.new respond_to do |format| - format.html # new.html.erb + format.html format.json { render json: @post } end end - # GET /posts/1/edit def edit @post = Post.find(params[:id]) end - # POST /posts - # POST /posts.json def create @post = Post.new(params[:post]) respond_to do |format| if @post.save @@ -53,12 +44,10 @@ format.json { render json: @post.errors, status: :unprocessable_entity } end end end - # PUT /posts/1 - # PUT /posts/1.json def update @post = Post.find(params[:id]) respond_to do |format| if @post.update_attributes(params[:post]) @@ -69,11 +58,9 @@ 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 respond_to do |format|