rails 3 json not rending user id -
i have simple @user = user.all
user has firstname, lastname, email , devics stuff.
but when render json, don't user.id. other info.
format.json { render :json => @users, :except => [:encrypted_password, :last_sign_in_at, :last_sign_in_ip, :reset_password_sent_at, :reset_password_token, :remember_created_at, :sign_in_count], :include => [:profile, :authentications] }
use @users.to_json(:except....), not @users, except
see api reference
Comments
Post a Comment