Created
April 21, 2010 03:29
-
-
Save anathematic/373383 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build_payable_by_attributes | |
# Automatically build payable_by - in javascript we'll give the user control to change these on ContractIspsController#new | |
payable_by.eql?("shared") ? count = 3 : count = 1 | |
remove_older_payment_amounts | |
count.times do | |
payable_amounts.build(:amount => 0) if payable_amounts.size != count | |
end | |
end | |
def remove_older_payment_amounts | |
payable_amounts.each { |p| p.destroy } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment