Sha256: b61aee3b26879b6c0ed72ac1e07a1cd3b84948b6012227adb0876effe212f3c9

Contents?: true

Size: 618 Bytes

Versions: 21

Compression:

Stored size: 618 Bytes

Contents

# -*- encoding : utf-8 -*-
class Search < ActiveRecord::Base
  
  belongs_to :user
  
  serialize :query_params
  attr_accessible :query_params
  
  # 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', Date.today - days_old])
  end
  
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
blacklight-4.2.0 app/models/search.rb
blacklight-4.1.0 app/models/search.rb
blacklight-4.0.1 app/models/search.rb
blacklight-3.8.2 app/models/search.rb
blacklight-4.0.0 app/models/search.rb
blacklight-4.0.0.rc2 app/models/search.rb
blacklight-4.0.0.rc1 app/models/search.rb
blacklight-4.0.0.pre7 app/models/search.rb
blacklight-4.0.0.pre6 app/models/search.rb
blacklight-3.8.1 app/models/search.rb
blacklight-3.8.0 app/models/search.rb
blacklight-3.7.2 app/models/search.rb
blacklight-3.7.1 app/models/search.rb
blacklight-3.7.0 app/models/search.rb
blacklight-3.6.1.1 app/models/search.rb
blacklight-3.6.0 app/models/search.rb
blacklight-3.5.0 app/models/search.rb
blacklight-3.4.2 app/models/search.rb
blacklight-3.4.1 app/models/search.rb
blacklight-3.4.0 app/models/search.rb