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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -