diff --git a/app/helpers/registration_limitation_helper.rb b/app/helpers/registration_limitation_helper.rb index 56523b816cdf54..c295dc074665b4 100644 --- a/app/helpers/registration_limitation_helper.rb +++ b/app/helpers/registration_limitation_helper.rb @@ -26,7 +26,7 @@ def today_increase_user_count end def today_increase_user_count_value - User.confirmed.enabled.where('users.created_at >= ?', Time.now.utc.beginning_of_day).joins(:account).merge(Account.without_suspended).count + User.confirmed.enabled.where(users: { created_at: Time.now.utc.beginning_of_day.. }).joins(:account).merge(Account.without_suspended).count end def registrations_in_time? diff --git a/app/lib/importer/public_statuses_index_importer.rb b/app/lib/importer/public_statuses_index_importer.rb index 02134dc2517052..14fb97e3fd2ec3 100644 --- a/app/lib/importer/public_statuses_index_importer.rb +++ b/app/lib/importer/public_statuses_index_importer.rb @@ -28,8 +28,8 @@ def index def scope to_index = Status.indexable.reorder(nil) - to_index = to_index.where('statuses.created_at >= ?', @from) if @from.present? - to_index = to_index.where('statuses.created_at < ?', @to) if @to.present? + to_index = to_index.where(statuses: { created_at: @from.. }) if @from.present? + to_index = to_index.where(statuses: { created_at: ...@to }) if @to.present? to_index end end diff --git a/app/lib/importer/statuses_index_importer.rb b/app/lib/importer/statuses_index_importer.rb index 5a8fa29c869b17..9ef58b1358134e 100644 --- a/app/lib/importer/statuses_index_importer.rb +++ b/app/lib/importer/statuses_index_importer.rb @@ -17,8 +17,8 @@ def import! bulk = ActiveRecord::Base.connection_pool.with_connection do to_index = index.adapter.default_scope.where(id: status_ids) - to_index = to_index.where('created_at >= ?', @from) if @from.present? - to_index = to_index.where('created_at < ?', @to) if @to.present? + to_index = to_index.where(created_at: @from..) if @from.present? + to_index = to_index.where(created_at: ...@to) if @to.present? crutches = Chewy::Index::Crutch::Crutches.new index, to_index to_index.map do |object| # This is unlikely to happen, but the post may have been diff --git a/app/lib/vacuum/list_statuses_vacuum.rb b/app/lib/vacuum/list_statuses_vacuum.rb index 41dca7602f6c1b..e89f6475aa6734 100644 --- a/app/lib/vacuum/list_statuses_vacuum.rb +++ b/app/lib/vacuum/list_statuses_vacuum.rb @@ -12,6 +12,6 @@ def perform private def vacuum_list_statuses! - ListStatus.where('created_at < ?', LIST_STATUS_LIFE_DURATION.ago).in_batches.destroy_all + ListStatus.where(created_at: ...LIST_STATUS_LIFE_DURATION.ago).in_batches.destroy_all end end diff --git a/app/lib/vacuum/ng_histories_vacuum.rb b/app/lib/vacuum/ng_histories_vacuum.rb index f70558f1160085..1b9f42d7fefbaf 100644 --- a/app/lib/vacuum/ng_histories_vacuum.rb +++ b/app/lib/vacuum/ng_histories_vacuum.rb @@ -12,7 +12,7 @@ def perform private def vacuum_histories! - NgwordHistory.where('created_at < ?', HISTORY_LIFE_DURATION.ago).in_batches.destroy_all - NgRuleHistory.where('created_at < ?', HISTORY_LIFE_DURATION.ago).in_batches.destroy_all + NgwordHistory.where(created_at: ...HISTORY_LIFE_DURATION.ago).in_batches.destroy_all + NgRuleHistory.where(created_at: ...HISTORY_LIFE_DURATION.ago).in_batches.destroy_all end end diff --git a/app/models/concerns/account/interactions.rb b/app/models/concerns/account/interactions.rb index 664ec056c10de9..979b2278dc8e08 100644 --- a/app/models/concerns/account/interactions.rb +++ b/app/models/concerns/account/interactions.rb @@ -212,7 +212,7 @@ def followed_by_domain?(other_domain, since = nil) return false unless local? scope = followers - scope = scope.where('follows.created_at < ?', since) if since.present? + scope = scope.where(follows: { created_at: ...since }) if since.present? scope.exists?(domain: other_domain) end