Last active
August 29, 2015 14:27
-
-
Save josecoelho/1ca7a3fe68599898cb43 to your computer and use it in GitHub Desktop.
This file contains 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 create_invoices | |
interval = 1.month | |
cicle = 12 #quantidade desejada | |
start_date = Date.today #data inicial | |
current_date = start_date | |
cicle.times do | |
# criar o que você precisa, alguns exemplos: | |
# invoices.create(date: current_date, outro_campo: "Algum outro valor") | |
# invoices << Invoice.create(date: current_date) | |
# Invoice.create(date: current_date, relation_id: self.id) | |
# imprindo data atual para fins de demonstração | |
puts current_date | |
current_date += interval | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment