Commit a13bb5960eebdd9d1a23a532b45abf49bfa48d4d

Authored by Braulio Bhavamitra
1 parent d486c3ff

rails4: force html rendering for 403/404

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
app/controllers/application_controller.rb
@@ -157,7 +157,8 @@ class ApplicationController < ActionController::Base @@ -157,7 +157,8 @@ class ApplicationController < ActionController::Base
157 def render_not_found(path = nil) 157 def render_not_found(path = nil)
158 @no_design_blocks = true 158 @no_design_blocks = true
159 @path ||= request.path 159 @path ||= request.path
160 - render template: 'shared/not_found', status: 404, layout: get_layout 160 + # force html template even if the browser asked for a image
  161 + render template: 'shared/not_found', status: 404, layout: get_layout, formats: [:html]
161 end 162 end
162 alias :render_404 :render_not_found 163 alias :render_404 :render_not_found
163 164
@@ -165,7 +166,8 @@ class ApplicationController < ActionController::Base @@ -165,7 +166,8 @@ class ApplicationController < ActionController::Base
165 @no_design_blocks = true 166 @no_design_blocks = true
166 @message = message 167 @message = message
167 @title = title 168 @title = title
168 - render template: 'shared/access_denied', status: 403 169 + # force html template even if the browser asked for a image
  170 + render template: 'shared/access_denied', status: 403, formats: [:html]
169 end 171 end
170 172
171 def load_category 173 def load_category