Class: SearchResult

Inherits:
ApplicationRecord show all
Defined in:
app/models/search_result.rb

Overview

== Schema Information

Table name: search_results
Database name: primary

id :integer not null, primary key
custom1 :string(255)
custom2 :string(255)
position :integer
resource_type :string(255) not null
status :integer
created_at :datetime
updated_at :datetime
resource_id :integer not null
search_id :integer not null

Indexes

idx_resource_type_resource_id (resource_type,resource_id)
idx_search_results (search_id,resource_type,resource_id)
idx_search_results_unique (search_id,resource_id,resource_type) UNIQUE
index_search_results_resource_id (resource_id)

Foreign Keys

fk_rails_... (search_id => searches.id) ON DELETE => cascade

Belongs to collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Method Details

#presenting_context?(context_type, context_id) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/models/search_result.rb', line 42

def presenting_context? context_type, context_id
  self.resource_id == context_id && self.resource_type == context_type
end

#resourceResource

Returns:

  • (Resource)

See Also:



33
# File 'app/models/search_result.rb', line 33

belongs_to :resource, :polymorphic => true, optional: true

#searchSearch

acts_as_list :scope => :search

Returns:

See Also:



32
# File 'app/models/search_result.rb', line 32

belongs_to :search, :inverse_of => :search_results, optional: true