diff --git a/app/controller/alchemy/pg_search/controller_methods.rb b/app/controller/alchemy/pg_search/controller_methods.rb index cc2ebcd..fc59ec0 100644 --- a/app/controller/alchemy/pg_search/controller_methods.rb +++ b/app/controller/alchemy/pg_search/controller_methods.rb @@ -86,7 +86,7 @@ def paginate_per def set_preview_query if self.class == Alchemy::Admin::PagesController && params[:query].blank? - element = search_result_page.draft_version.elements.named(:searchresults).first + element = search_result_page&.draft_version&.elements&.named(:searchresults)&.first params[:query] = element&.value_for("search_string") || "lorem" end