Skip to content

Instantly share code, notes, and snippets.

@mlangenberg
Created November 10, 2011 22:08
Show Gist options
  • Save mlangenberg/1356402 to your computer and use it in GitHub Desktop.
Save mlangenberg/1356402 to your computer and use it in GitHub Desktop.
@ticket = Ticket.last
@ticket.patches.size #=> 0
patch = @ticket.patches.find_or_initialize_by_user('Matt')
@ticket.patches.size #=> 1
@ticket.patches.last.new_record? #=> true
patch.save
@ticket.patches.size #=> 2 <-- wait wut?
@ticket.patches.last.new_record? #=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment