From fb7f21fbe90a00af7d4533da8546aa0ebf1649de Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 29 Jan 2019 10:24:32 -0500 Subject: [PATCH] Clearer syntax in migration Following up on 1c1fd205 --- ...0110142917_enable_content_security_policy_for_new_sites.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20190110142917_enable_content_security_policy_for_new_sites.rb b/db/migrate/20190110142917_enable_content_security_policy_for_new_sites.rb index bf7af9faec..abe55353a0 100644 --- a/db/migrate/20190110142917_enable_content_security_policy_for_new_sites.rb +++ b/db/migrate/20190110142917_enable_content_security_policy_for_new_sites.rb @@ -18,8 +18,8 @@ class EnableContentSecurityPolicyForNewSites < ActiveRecord::Migration[5.2] end def instance_is_new? - post = DB.query_single("SELECT created_at FROM posts ORDER BY created_at ASC LIMIT 1") - return post.blank? || (post.present? && post.first > 1.week.ago) + dates = DB.query_single("SELECT created_at FROM posts ORDER BY created_at ASC LIMIT 1") + dates.empty? || dates.first > 1.week.ago end end