app/models/external_services/service.rb in external_services-0.2.4 vs app/models/external_services/service.rb in external_services-0.3.0
- old
+ new
@@ -3,10 +3,13 @@
self.table_name = :external_services
belongs_to :subject, polymorphic: true
serialize :extra_data, JSON
- after_update :on_first_sync, if: -> { external_id_was.nil? && external_id_changed? }
+ after_update :on_first_sync, if: proc { # Rails 5.1+ support
+ (respond_to?(:saved_change_to_external_id?) ? saved_change_to_external_id? : external_id_changed? ) &&
+ (respond_to?(:external_id_before_last_save) ? external_id_before_last_save.nil? : external_id_was)
+ }
def self.to_sym
to_s.demodulize.underscore.to_sym
end