Created
August 25, 2010 21:28
-
-
Save anonymous/550339 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 card_assign card, employee | |
active_card = card.card_assignments.all(:conditions=>["active_since < #{DateTime.now} and #{DateTime.now} < active_until"]).first | |
if not current_card.nil? then | |
active_card.active_until = DateTime.now | |
end | |
active_card = CardAssignment.new | |
active_card.active_since = DateTime.now | |
active_card.active_until = DateTime.now + 1 year | |
active_card.first_time = true | |
employee.card_assignments.add active_card | |
card.card_assignments.add active_card | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment