deviseのcurrent_userを別のmodelで呼び出したいです。
lang
1 validate :cross_opportunity 2 def cross_opportunity 3 id = current_user.id 4 @opportunity = Opportunity.where(user_id: id) 5 errors.add(:base, 'xxxxxxxxx') if @opportunity.where(opportued_id:self.opportuer_id ,opportuer_id:self.opportued_id) 6 end
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/01/24 06:54