Add created_before and updated_before scopes to MediaAttachment (#28869)
This commit is contained in:
@@ -204,12 +204,14 @@ class MediaAttachment < ApplicationRecord
|
||||
validates :file, presence: true, if: :local?
|
||||
validates :thumbnail, absence: true, if: -> { local? && !audio_or_video? }
|
||||
|
||||
scope :attached, -> { where.not(status_id: nil).or(where.not(scheduled_status_id: nil)) }
|
||||
scope :cached, -> { remote.where.not(file_file_name: nil) }
|
||||
scope :local, -> { where(remote_url: '') }
|
||||
scope :ordered, -> { order(id: :asc) }
|
||||
scope :remote, -> { where.not(remote_url: '') }
|
||||
scope :attached, -> { where.not(status_id: nil).or(where.not(scheduled_status_id: nil)) }
|
||||
scope :cached, -> { remote.where.not(file_file_name: nil) }
|
||||
scope :created_before, ->(value) { where(arel_table[:created_at].lt(value)) }
|
||||
scope :local, -> { where(remote_url: '') }
|
||||
scope :ordered, -> { order(id: :asc) }
|
||||
scope :remote, -> { where.not(remote_url: '') }
|
||||
scope :unattached, -> { where(status_id: nil, scheduled_status_id: nil) }
|
||||
scope :updated_before, ->(value) { where(arel_table[:updated_at].lt(value)) }
|
||||
|
||||
attr_accessor :skip_download
|
||||
|
||||
|
||||
Reference in New Issue
Block a user