在我的rails应用程序中,有一个名为PushToken的类 class PushToken < ApplicationRecord,这应该创建一个新的PushToken或更新现有的token属性。现在,在生产环境中,我在update!行收到以下错误: Validation failed: User has already been taken, Token has already been taken 我不明白这是怎么发生的。如果user和to
我有三种型号:如果我正在循环浏览raw_coupons,那么如何将其保存为优惠券,只有在该商店不存在相同的coupon_code时才能保存它?coupon.save if [coupon_code for this store doesn't already exist]如何为该商店编写coupon_code :couponcoupo