Skip to content

Instantly share code, notes, and snippets.

@rebo
Created December 13, 2010 23:52
Show Gist options
  • Save rebo/739813 to your computer and use it in GitHub Desktop.
Save rebo/739813 to your computer and use it in GitHub Desktop.
class Employee < ActiveRecord::Base
has_many :events
def self.in_on_date(date)
Event.where(:date => date).map{ |e| e.employee.name }.uniq
end
def book_in_date!(date)
self.events.build(:date => date)
self.save!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment