Skip to content

Instantly share code, notes, and snippets.

@simmo
Created October 10, 2011 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simmo/1276187 to your computer and use it in GitHub Desktop.
Save simmo/1276187 to your computer and use it in GitHub Desktop.
Rails 3: Limit attributes return with JSON/XML
class User < ActiveRecord::Base
respond_to :html, :json, :xml
def show
respond_with @user = User.find(params[:id]), :except => [:password, :email]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment