2017-09-12 33 views
0

從色器件user表中的所有字段我嘗試檢索的JSON哈希sign_in_count場JSON沒有出現在回報率

data = User.where customer: current_user.id 
render :json => data 

它只返回字段:ID,姓名,電子郵件,創建/更新和客戶,但而不是其餘的表格字段。這是Devise中的配置設置嗎?

在user.rb我有:

devise 
:database_authenticatable,:registerable,:recoverable,:rememberable, 
:trackable, :validatable, :confirmable, :lockable, :zxcvbnable, 
:timeoutable 

回答

0

這並獲得成功。

data.as_json(:force_except => Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION.delete_if{|x| x == :sign_in_count})