Guest User

Untitled

a guest
Jul 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. class Bid < ActiveRecord::Base
  2. belongs_to :user
  3. validate do |bid|
  4. check_fund
  5. end
  6.  
  7. def check_fund
  8. user = User.find(self.user_id)
  9. errors.add(:user, "user's funds is insufficent") unless user.funds - self.txn > -1
  10. end
  11. end
Add Comment
Please, Sign In to add comment