这是我在rails服务器日志中获得的奇怪警告
弃用警告:回调之后
changed_attributes
内部的行为将在下一版本的Rails中发生变化。新的返回值将反映save
返回后调用方法的行为(例如,它现在返回的相反)。要保持当前行为,请改用saved_changes.transform_values(&:first)
。
以下是导致它的代码
def create_account
user = User.new(
first_name: @user_details['first_name'],
last_name: @user_details['last_name'],
email: @user_details['email'],
timezone: @user_details['timezone'],
locale: @user_details['locale'],
:remote_avatar_url => @user_details['picture']['data']['url'].to_s
)
if user.save ## this is the line that seems to be in logs
render json: {
auth_token: user.auth_token,
status: 200,
show_categories_screen: true
}
else
render json: { errors: user.errors.messages, status: 500 }
end
end
Rails版本是5.1.2