Skip to content

Instantly share code, notes, and snippets.

@sammarcus
Created October 27, 2014 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sammarcus/4c0157b6795abc84f91f to your computer and use it in GitHub Desktop.
Save sammarcus/4c0157b6795abc84f91f to your computer and use it in GitHub Desktop.
class Kid < ActiveRecord::Base
has_one :bucket
has_many :candies, through: :bucket
def pig_out(num)
if num <4
self.feeling = "Happy"
else
self.feeling = "Sick"
end
self.bucket.candies[1, num].each do |c|
c.destroy
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment