From 23318bbe07b73cef50ec69d5e597386a116e2b82 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Sun, 11 Mar 2018 21:34:42 -0700 Subject: Refs #6075 Replace after_commit callback to after_create for the set_defaults method --- app/models/chouette/stop_point.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'app/models') diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index 8d341c435..42a207774 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -30,15 +30,11 @@ module Chouette delegate :name, to: :stop_area - after_commit :set_defaults + after_create :set_defaults def set_defaults - if stop_area.kind == 'commercial' - update_attribute :for_boarding, 'normal' - update_attribute :for_alighting, 'normal' - else - update_attribute :for_boarding, 'forbidden' - update_attribute :for_alighting, 'forbidden' - end + value = stop_area.kind == 'commercial' ? 'normal' : 'forbidden' + update_attribute :for_boarding, value + update_attribute :for_alighting, value end before_destroy :remove_dependent_journey_pattern_stop_points -- cgit v1.2.3