0
0
Fork 0

Fix Rails/WhereRange cop (#30343)

This commit is contained in:
Matt Jankowski 2024-05-20 05:37:36 -04:00 committed by GitHub
parent 70608f824e
commit def6b686ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 15 additions and 15 deletions

View file

@ -4,7 +4,7 @@ module Expireable
extend ActiveSupport::Concern
included do
scope :expired, -> { where.not(expires_at: nil).where('expires_at < ?', Time.now.utc) }
scope :expired, -> { where.not(expires_at: nil).where(expires_at: ...Time.now.utc) }
def expires_in
return @expires_in if defined?(@expires_in)

View file

@ -24,7 +24,7 @@ class Invite < ApplicationRecord
belongs_to :user, inverse_of: :invites
has_many :users, inverse_of: :invite, dependent: nil
scope :available, -> { where(expires_at: nil).or(where('expires_at >= ?', Time.now.utc)) }
scope :available, -> { where(expires_at: nil).or(where(expires_at: Time.now.utc..)) }
validates :comment, length: { maximum: COMMENT_SIZE_LIMIT }