From ffc45b6e4b933cf7325186213d69590ad459b093 Mon Sep 17 00:00:00 2001 From: d-m-u Date: Tue, 23 Jul 2019 11:28:39 -0400 Subject: [PATCH] Cleanup the save for notification type seeding --- app/models/notification_type.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/models/notification_type.rb b/app/models/notification_type.rb index 9a68a0d9416..f1b789270aa 100644 --- a/app/models/notification_type.rb +++ b/app/models/notification_type.rb @@ -47,14 +47,9 @@ def self.names def self.seed seed_data.each do |t| - rec = find_by(:name => t[:name]) t[:expires_in] = t[:expires_in].to_i_with_method - if rec.nil? - create(t) - else - rec.update_attributes(t) - rec.save! - end + rec = find_by(:name => t[:name]) || new + rec.update!(t) end end