Sha256: 72f734c228ecbfb318c78be4cb9c46827ed73c66c5fc09942224e6b1b9e72efb

Contents?: true

Size: 471 Bytes

Versions: 3

Compression:

Stored size: 471 Bytes

Contents

require_dependency Locomotive::Engine.root.join('app', 'models', 'locomotive', 'content_entry').to_s

Locomotive::ContentEntry.class_eval do
  include Locomotive::Search::Extension
  
  search_by :options_for_search
  
  def options_for_search
    store = [:_slug, _label_field_name, :site_id, :content_type_slug]
    content_type.entries_custom_fields.where(searchable: true).map(&:name) << {store: store}
  end
  
  def content_type_slug
    content_type.slug
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms-search-0.0.4 app/models/locomotive/content_entry.rb
locomotivecms-search-0.0.3 app/models/locomotive/content_entry.rb
locomotivecms-search-0.0.2 app/models/locomotive/content_entry.rb