@@ -16,7 +16,9 @@ class Page < ApplicationRecord
1616 has_many :page_blocks , -> { positioned } , dependent : :destroy , class_name : 'BetterTogether::Content::PageBlock'
1717 has_many :blocks , through : :page_blocks
1818 has_many :image_blocks , -> { where ( type : 'BetterTogether::Content::Image' ) } , through : :page_blocks , source : :block
19- has_many :rich_text_blocks , -> { where ( type : 'BetterTogether::Content::RichText' ) } , through : :page_blocks , source : :block
19+ has_many :rich_text_blocks , lambda {
20+ where ( type : 'BetterTogether::Content::RichText' )
21+ } , through : :page_blocks , source : :block
2022
2123 accepts_nested_attributes_for :page_blocks , allow_destroy : true
2224
@@ -53,15 +55,13 @@ class Page < ApplicationRecord
5355 scope :by_publication_date , -> { order ( published_at : :desc ) }
5456
5557 # Customize the data sent to Elasticsearch for indexing
56- def as_indexed_json ( options = { } )
57- self . as_json (
58+ def as_indexed_json ( _options = { } ) # rubocop:todo Metrics/MethodLength
59+ as_json (
5860 methods : [ :title , :content , *self . class . localized_attribute_list ] ,
59-
61+
6062 include : {
6163 rich_text_content : { only : :body } ,
62- image_blocks : {
63-
64- } ,
64+ image_blocks : { } ,
6565 rich_text_blocks : {
6666 include : {
6767 rich_text_content : { only : :body }
0 commit comments