我有一个具有 [ :user_id
, :activity_id
, :date
, ....]等属性的费用模型
关系是:
expense belongs_to user
expense belongs_to activity
我有以下验证。
validates :activity_id, uniqueness: scope: [:user_id, :date], message: "Expense for 'activity_name' on date '1/1/2012' is already entered"
如何获取activity_name
并date
进入错误消息?