From 5f0ae36745a4c9dfab75ebf77824e68e50a76fe1 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Mon, 7 Nov 2011 13:38:07 +0100 Subject: [PATCH] Tweaked the model a bit (forgotten the hourly_rate attribute). --- stoptime.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stoptime.rb b/stoptime.rb index c0efd35..d57b8c4 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -79,15 +79,21 @@ module StopTime::Models def fixed_cost? not self.fixed_cost.blank? end + + def task_type + fixed_cost? ? "fixed_cost" : "hourly_rate" + end end class TimeEntry < Base belongs_to :task + has_one :customer, :through => :task has_one :invoice end class Invoice < Base has_many :time_entries + has_many :tasks, :through => :time_entries belongs_to :customer end @@ -153,11 +159,13 @@ module StopTime::Models def self.up add_column(Task.table_name, :billed, :boolean) add_column(Task.table_name, :fixed_cost, :float) + add_column(Task.table_name, :hourly_rate, :float) end def self.down remove_column(Task.table_name, :billed) remove_column(Task.table_name, :fixed_cost) + remove_column(Task.table_name, :hourly_rate, :float) end end