Commit ff85a006 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Move condition to a callback

Move the check to update the issue title to `after_create` callback
parent 6a5d8499
......@@ -34,7 +34,7 @@ module EE
validates :weight, allow_nil: true, numericality: { greater_than_or_equal_to: 0 }
after_create :update_generic_alert_title_if_applicable
after_create :update_generic_alert_title, if: :generic_alert_with_default_title?
end
class_methods do
......@@ -134,8 +134,8 @@ module EE
private
def update_generic_alert_title_if_applicable
update(title: "#{title} #{iid}") if generic_alert_with_default_title?
def update_generic_alert_title
update(title: "#{title} #{iid}")
end
def generic_alert_with_default_title?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment