Sha256: 57e19276a76517ca3ca1a1186cc9d3cd7e02e27575260f1b970819db88167373
Contents?: true
Size: 752 Bytes
Versions: 31
Compression:
Stored size: 752 Bytes
Contents
class WorkAccount < ActiveRecord::Base has_many :backlogs, :dependent => :nullify has_many :works, :dependent => :destroy has_and_belongs_to_many :work_lock_subscribers, :class_name => 'User', :join_table => "work_lock_subscriptions", :foreign_key => "work_account_id", :association_foreign_key => 'subscriber_user_id' validates_inclusion_of :track_times, :in => [true, false], :allow_nil => true, :message => ActiveRecord::Errors.default_error_messages[:blank] validates_length_of :invoice_code, :allow_nil => true, :maximum => 255 validates_uniqueness_of :name def enable_invoicing? invoice_code && invoice_code.length > 0 end def total_hours works.inject(BigDecimal('0')) {|total, work| total + work.hours} end end
Version data entries
31 entries across 31 versions & 1 rubygems