Class: Payment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/payment.rb

Instance Method Summary collapse

Instance Method Details

#valid_amountObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/payment.rb', line 14

def valid_amount
  if amount < 0
    errors[:amount] = "cannot be less than 0"
  end
  if amount > subscription.balance
    errors[:amount] = "cannot be more than your balance"
  end
  if amount == 0
    errors[:amount] = "cannot be zero"
  end
end