marnen/duckbill

View on GitHub
app/models/time_entry.rb

Summary

Maintainability
A
0 mins
Test Coverage
class TimeEntry < ActiveRecord::Base
  belongs_to :invoice
  belongs_to :project
  has_one :user, through: :project
  [:project_id, :date, :hours, :description].each {|field| validates field, presence: true }

  class << self
    def resource_params
      [:project_id, :date, :hours, :description, :notes]
    end

    def uninvoiced
      where invoice_id: nil
    end
  end
end