[#4604] Clear and recalculate the #cost on Rate#save
This commit is contained in:
@@ -11,6 +11,7 @@ class Rate < ActiveRecord::Base
|
||||
validates_numericality_of :amount
|
||||
|
||||
before_save :unlocked?
|
||||
after_save :update_time_entry_cost_cache
|
||||
before_destroy :unlocked?
|
||||
|
||||
named_scope :history_for_user, lambda { |user, order|
|
||||
@@ -36,6 +37,10 @@ class Rate < ActiveRecord::Base
|
||||
def specific?
|
||||
return !self.default?
|
||||
end
|
||||
|
||||
def update_time_entry_cost_cache
|
||||
TimeEntry.update_cost_cache(user, project)
|
||||
end
|
||||
|
||||
# API to find the Rate for a +user+ on a +project+ at a +date+
|
||||
def self.for(user, project = nil, date = Date.today.to_s)
|
||||
|
||||
Reference in New Issue
Block a user