Add the location class

This commit is contained in:
Bram Senders 2011-11-23 15:23:40 +01:00
parent a4e42d9aca
commit 1b00857d62
1 changed files with 13 additions and 0 deletions

View File

@ -156,6 +156,7 @@ module StopTime::Models
# task.
class TimeEntry < Base
belongs_to :task
belongs_to :location
has_one :customer, :through => :task
# Returns the total amount of time, the duration, in hours.
@ -170,6 +171,7 @@ module StopTime::Models
# tasks and through the tasks registered time.
class Invoice < Base
has_many :tasks
has_many :locations
has_many :time_entries, :through => :tasks
belongs_to :customer
@ -203,6 +205,17 @@ module StopTime::Models
class CompanyInfo < Base
end
# == The location class
#
# This class represents a specific location where work can be done.
# Each location has a name, a distance (in kilometres, from the user's
# home) and travel time (in minutes, also from the user's home). Each
# time entry can be associated with a location.
class Location < Base
has_many :time_entries
belongs_to :invoice
end
class StopTimeTables < V 1.0 # :nodoc:
def self.up
create_table Customer.table_name do |t|