app/models/search.rb in blacklight-6.25.0 vs app/models/search.rb in blacklight-7.0.0.rc1

- old
+ new

@@ -1,23 +1,19 @@ # 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 +class Search < ApplicationRecord + belongs_to :user, optional: true - # use a backwards-compatible serializer until the Rails API stabilizes and we can evaluate for major-revision compatibility - serialize :query_params, Blacklight::SearchParamsYamlCoder + serialize :query_params - attr_accessible :query_params if Blacklight::Utils.needs_attr_accessible? - # A Search instance is considered a saved search if it has a user_id. def saved? - self.user_id? + user_id? end # delete old, unsaved searches def self.delete_old_searches(days_old) raise ArgumentError, 'days_old is expected to be a number' unless days_old.is_a?(Numeric) raise ArgumentError, 'days_old is expected to be greater than 0' if days_old <= 0 - self.where(['created_at < ? AND user_id IS NULL', Time.zone.today - days_old]).destroy_all + where(['created_at < ? AND user_id IS NULL', Time.zone.today - days_old]).destroy_all end end