[#4420] Fixed the after_save callback for Retainers.
This commit is contained in:
1 parent
7d43ab7d74
commit
fc28f8351f
2 files changed
+11
-2
No files matched your search
@@ -22,6 +22,16 @@ class Deliverable < ActiveRecord::Base
|
|||||||
|
|
||||||
delegate :name, :to => :contract, :prefix => true, :allow_nil => true
|
delegate :name, :to => :contract, :prefix => true, :allow_nil => true
|
||||||
|
|
||||||
|
# Callbacks
|
||||||
|
|
||||||
|
# Register callbacks here, on new records the class isn't set so class-specific
|
||||||
|
# callbacks don't fire.
|
||||||
|
def after_save
|
||||||
|
if type == "RetainerDeliverable"
|
||||||
|
self.becomes(self.type.constantize).create_budgets_for_periods
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
named_scope :by_title, {:order => "#{Deliverable.table_name}.title ASC"}
|
named_scope :by_title, {:order => "#{Deliverable.table_name}.title ASC"}
|
||||||
|
|
||||||
def short_type
|
def short_type
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ class RetainerDeliverable < HourlyDeliverable
|
|||||||
# Accessors
|
# Accessors
|
||||||
|
|
||||||
# Callbacks
|
# Callbacks
|
||||||
after_save :create_budgets_for_periods
|
|
||||||
|
|
||||||
def short_type
|
def short_type
|
||||||
'R'
|
'R'
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user