Sha256: aa0a2165bd80e9bfdbd8235703d9a8ca02df7151fb1c0bb8a7f7f735998a016d
Contents?: true
Size: 771 Bytes
Versions: 3
Compression:
Stored size: 771 Bytes
Contents
# frozen_string_literal: true class Search < ActiveRecord::Base belongs_to_arguments = { optional: true } if Rails.version >= '5.0.0' belongs_to :user, belongs_to_arguments serialize :query_params if Blacklight::Utils.needs_attr_accessible? attr_accessible :query_params end # A Search instance is considered a saved search if it has a user_id. def saved? self.user_id? end # delete old, unsaved searches def self.delete_old_searches(days_old) raise ArgumentError.new('days_old is expected to be a number') unless days_old.is_a?(Numeric) raise ArgumentError.new('days_old is expected to be greater than 0') if days_old <= 0 self.destroy_all(['created_at < ? AND user_id IS NULL', Time.zone.today - days_old]) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blacklight-6.0.2 | app/models/search.rb |
blacklight-6.0.1 | app/models/search.rb |
blacklight-6.0.0 | app/models/search.rb |