Clearer syntax in migration

Following up on 1c1fd205
This commit is contained in:
Penar Musaraj 2019-01-29 10:24:32 -05:00
parent 32f9fd1e51
commit fb7f21fbe9

View File

@ -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