Class: ReportKeyword

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/report_keyword.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.klassObject

This is to simulate has_many :report_keywords relation for scoped_search library to work NOTE: This won’t work for any other purpose



8
9
10
# File 'app/models/report_keyword.rb', line 8

def self.klass
  self
end

.macroObject

Needed for ActiveRecord to simulate ActiveRecord::Associations::CollectionProxy



13
14
15
# File 'app/models/report_keyword.rb', line 13

def self.macro
  :has_many
end

Instance Method Details

#host_reportsObject



2
3
4
# File 'app/models/report_keyword.rb', line 2

def host_reports
  HostReport.where("report_keyword_ids @> ?", "{#{id}}")
end