Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created March 27, 2012 10:54
Show Gist options
  • Save jlebrech/2214848 to your computer and use it in GitHub Desktop.
Save jlebrech/2214848 to your computer and use it in GitHub Desktop.
Update Count on create
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