Skip to content

Instantly share code, notes, and snippets.

@supriya
Created July 16, 2009 14:54
Show Gist options
  • Save supriya/148451 to your computer and use it in GitHub Desktop.
Save supriya/148451 to your computer and use it in GitHub Desktop.
a/app/models/card.rb
+++ b/app/models/card.rb
@@ -66,9 +66,17 @@ class Card < ActiveRecord::Base
end
else
#FIXME logic for Personalized cards
+ if (self.balance + amount) <= max_balance
+ if (self.card_load_transactions.for_today.sum(:amount) <= max_daily_loads)
+ return true
+ else
+ return false
+ end
+ else
return false
end
end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment