app/models/piggybak/payment_method.rb in piggybak-0.7.0 vs app/models/piggybak/payment_method.rb in piggybak-0.7.1
- old
+ new
@@ -24,10 +24,10 @@
end
end
end
end
validates_each :active do |record, attr, value|
- if value && PaymentMethod.find_all_by_active(true).select { |p| p != record }.size > 0
+ if value && PaymentMethod.where(active: true).select { |p| p != record }.size > 0
record.errors.add attr, "You may only have one active payment method."
end
end
def key_values