File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
app/models/better_together Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,11 @@ class Post < ApplicationRecord
2121 categorizable
2222
2323 translates :title
24+ alias name title
2425 translates :content , backend : :action_text
2526
27+ settings index : default_elasticsearch_index
28+
2629 slugged :title
2730
2831 validates :title ,
@@ -40,6 +43,16 @@ def to_s
4043
4144 configure_attachment_cleanup
4245
46+ # Customize the data sent to Elasticsearch for indexing
47+ def as_indexed_json ( _options = { } )
48+ as_json (
49+ only : [ :id ] ,
50+ methods : [ :title , :name , :slug , *self . class . localized_attribute_list . keep_if do |a |
51+ a . starts_with? ( 'title' || a . starts_with? ( 'slug' ) || a . starts_with? ( 'content' ) )
52+ end ]
53+ )
54+ end
55+
4356 private
4457
4558 def add_creator_as_author
You can’t perform that action at this time.
0 commit comments