From eb5d865ca3a8488ee747a4973141dca899b495e5 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 3 Feb 2016 22:52:50 -0800 Subject: [PATCH] Better example for search_data --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7dee380..5ab4ffa 100644 --- a/README.md +++ b/README.md @@ -338,12 +338,13 @@ Control what data is indexed with the `search_data` method. Call `Product.reinde ```ruby class Product < ActiveRecord::Base + belongs_to :department + def search_data - as_json only: [:name, :active] - # or equivalently { name: name, - active: active + department_name: department.name, + on_sale: sale_price.present? } end end @@ -353,7 +354,7 @@ Searchkick uses `find_in_batches` to import documents. To eager load associatio ```ruby class Product < ActiveRecord::Base - scope :search_import, -> { includes(:searches) } + scope :search_import, -> { includes(:department) } end ``` -- libgit2 0.21.0