File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
app/controllers/alchemy/json_api Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,17 @@ module JsonApi
55 class PagesController < JsonApi ::BaseController
66 before_action :load_page_for_cache_key , only : :show
77
8+ ALLOWED_PUBLIC_VERSION_RANSACK_ATTRIBUTES = %w[ public_on ] . map { |a | "public_version_#{ a } " } . freeze
9+
810 def index
911 allowed = Alchemy ::Page . ransackable_attributes
1012
1113 jsonapi_filter ( page_scope , allowed ) do |filtered_pages |
1214 @pages = filtered_pages . result
1315 if !@pages . all? ( &:cache_page? )
14- render_pages_json ( allowed ) && return
16+ render_pages_json ( allowed | ALLOWED_PUBLIC_VERSION_RANSACK_ATTRIBUTES ) && return
1517 elsif stale? ( last_modified : @pages . maximum ( :published_at ) , etag : @pages . max_by ( &:cache_key ) &.cache_key )
16- render_pages_json ( allowed )
18+ render_pages_json ( allowed | ALLOWED_PUBLIC_VERSION_RANSACK_ATTRIBUTES )
1719 end
1820 end
1921
You can’t perform that action at this time.
0 commit comments