Skip to content

Instantly share code, notes, and snippets.

@filipebarcos
Created October 31, 2016 18:38
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 filipebarcos/e45389fdda97ac8ac78e4cdb33900ce1 to your computer and use it in GitHub Desktop.
Save filipebarcos/e45389fdda97ac8ac78e4cdb33900ce1 to your computer and use it in GitHub Desktop.
class Project < ActiveRecord::Base
has_many :time_entries
has_many :unbilled_time_entries, -> { unbilled }, class_name: 'TimeEntry'
end
class TimeEntry < ActiveRecord::Base
scope :unbilled, -> { where(status: Status::UNBILLED) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment