Excluding fields from rails json and xml output
Rails has a very handy ‘respond_to’ feature to render your pages in different formats : respond_to do |format| format.json { render :json => @user } format.xml { render :xml => @user } format.html end However, by default it outputs every field in the model, which exposes some data (encrypted-password and password-salt) that I’d rather keep to myself : ...