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

Constant Summary

Constants included from Models::Schedulable

Models::Schedulable::SIMPLE_FORM_OPTIONS

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::Schedulable

config

Methods included from Models::AfterCommittable

#after_commit

Methods included from Models::EventPublishable

#publish_event

Instance Method Details

#presenting_context?(context_type, context_id) ⇒ Boolean

Parameters:

  • context_type (String)
  • context_id (Integer)

Returns:

  • (Boolean)


44
45
46
# File 'app/models/search_result.rb', line 44

def presenting_context?(context_type, context_id)
  resource_id == context_id && resource_type == context_type
end

#resourceActiveRecord::Base

Returns:

  • (ActiveRecord::Base)


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

belongs_to :resource, polymorphic: true, optional: true

#searchSearch

acts_as_list :scope => :search

Returns:

See Also:



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

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