Skip to content

Instantly share code, notes, and snippets.

@mbailey
Created February 20, 2011 02:30
Show Gist options
  • Save mbailey/835622 to your computer and use it in GitHub Desktop.
Save mbailey/835622 to your computer and use it in GitHub Desktop.
class PostController < ApplicationController
respond_to :json, :html, :jpg, :xml
def index
respond_with(@posts = Post.all),
:methods => [:average_rating],
:include => :comments
end
def show
respond_with(@post = Post.find(params[:id])), :only => [:name, :body]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment