Commit 53acbcd7fcc4f8cced206a99e9aa609ac6a73b7a
1 parent
2057aff5
Exists in
master
and in
21 other branches
Better example
Showing
1 changed file
with
9 additions
and
1 deletions
Show diff stats
README.md
@@ -131,7 +131,15 @@ Choose what data gets indexed. | @@ -131,7 +131,15 @@ Choose what data gets indexed. | ||
131 | ```ruby | 131 | ```ruby |
132 | class Product < ActiveRecord::Base | 132 | class Product < ActiveRecord::Base |
133 | def _source | 133 | def _source |
134 | - as_json(only: [:name, :active], include: {brand: {only: [:country]}}) | 134 | + as_json only: [:name, :active], include: {brand: {only: [:city]}} |
135 | + # or | ||
136 | + { | ||
137 | + name: self.name, | ||
138 | + active: self.active, | ||
139 | + brand: { | ||
140 | + city: self.brand.city | ||
141 | + } | ||
142 | + } | ||
135 | end | 143 | end |
136 | end | 144 | end |
137 | ``` | 145 | ``` |