File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ class PagesController < ApplicationController
3
3
4
4
def show
5
5
show_pages_params = params . permit ( :page , :layout )
6
+
6
7
page_to_show = whitelist_page ( show_pages_params [ :page ] )
7
8
8
9
render action : page_to_show , layout : whitelist_layout ( show_pages_params [ :layout ] )
@@ -12,15 +13,15 @@ def show
12
13
13
14
# Checks whether the requested_page exists in app/views/pages/*.html.haml
14
15
def whitelist_page ( requested_page )
15
- raise "Invalid page: #{ requested_page } " unless STATIC_PAGES . include? ( requested_page )
16
+ raise "Invalid page: #{ requested_page } " unless :: STATIC_PAGES . include? ( requested_page . to_s )
16
17
17
18
requested_page
18
19
end
19
20
20
21
def whitelist_layout ( requested_layout )
21
22
return 'application' if requested_layout . nil?
22
23
23
- raise "Invalid layout: #{ requested_layout } " unless STATIC_PAGE_LAYOUTS . include? ( requested_layout )
24
+ raise "Invalid layout: #{ requested_layout } " unless :: STATIC_PAGE_LAYOUTS . include? ( requested_layout . to_s )
24
25
25
26
requested_layout
26
27
end
You can’t perform that action at this time.
0 commit comments