comfy/comfortable-mexican-sofa — Issue #157: Use default public/404.html page
Author: glebm
Created: 2012-03-05 10:49:35+00:00
State: open

This bit of code here should not render text, but instead raise the exception further up.
At the very least this should be an option.

When CMS is used as a part of a bigger site, this behaviour is very confusing.

def load_cms_page
@cms_page = @cms_site.pages.published.find_by_full_path!("/#{params[:cms_path]}")
return redirect_to(@cms_page.target_page.full_path) if @cms_page.target_page

rescue ActiveRecord::RecordNotFound
if @cms_page = @cms_site.pages.published.find_by_full_path('/404')
render_html(404)
else
render :text => I18n.t('cms.content.page_not_found'), :status => 404
end
end