Created
March 27, 2012 10:54
-
-
Save jlebrech/2214848 to your computer and use it in GitHub Desktop.
Update Count on create
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
after_create :update_count | |
def update_count | |
tickets = Ticket.where(:player_id => self.player_id) | |
tickets.each do |t| | |
t.count_for_player = tickets.count | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment