adding some logging so it's possible to debug mystery page saving failures
Oleg
committed Oct 27, 2011
commit 1ddafb745e950d1d4f565ff714cd8203c229afac
Showing 7
changed files with
21 additions
and 2 deletions
app/controllers/cms_admin/categories_controller.rb
+4
-2
| @@ | @@ -8,13 +8,15 @@ class CmsAdmin::CategoriesController < CmsAdmin::BaseController |
| def create | |
| @category = Cms::Category.create!(params[:category]) | |
| - | rescue |
| + | rescue ActiveRecord::RecordInvalid |
| + | logger.detailed_error($!) |
| render :nothing => true | |
| end | |
| def update | |
| @category.update_attributes!(params[:category]) | |
| - | rescue |
| + | rescue ActiveRecord::RecordInvalid |
| + | logger.detailed_error($!) |
| render :nothing => true | |
| end | |
app/controllers/cms_admin/files_controller.rb
+2
-0
| @@ | @@ -42,6 +42,7 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController |
| end | |
| end | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| respond_to do |format| | |
| format.html do | |
| flash.now[:error] = I18n.t('cms.files.creation_failure') | |
| @@ | @@ -58,6 +59,7 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.files.updated') | |
| redirect_to :action => :edit, :id => @file | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.files.update_failure') | |
| render :action => :edit | |
| end | |
app/controllers/cms_admin/layouts_controller.rb
+2
-0
| @@ | @@ -21,6 +21,7 @@ class CmsAdmin::LayoutsController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.layouts.created') | |
| redirect_to :action => :edit, :id => @layout | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.layouts.creation_failure') | |
| render :action => :new | |
| end | |
| @@ | @@ -30,6 +31,7 @@ class CmsAdmin::LayoutsController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.layouts.updated') | |
| redirect_to :action => :edit, :id => @layout | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.layouts.update_failure') | |
| render :action => :edit | |
| end | |
app/controllers/cms_admin/pages_controller.rb
+2
-0
| @@ | @@ -28,6 +28,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.pages.created') | |
| redirect_to :action => :edit, :id => @page | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.pages.creation_failure') | |
| render :action => :new | |
| end | |
| @@ | @@ -37,6 +38,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.pages.updated') | |
| redirect_to :action => :edit, :id => @page | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.pages.update_failure') | |
| render :action => :edit | |
| end | |
app/controllers/cms_admin/sites_controller.rb
+2
-0
| @@ | @@ -24,6 +24,7 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.sites.created') | |
| redirect_to cms_admin_site_layouts_path(@site) | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.sites.creation_failure') | |
| render :action => :new | |
| end | |
| @@ | @@ -33,6 +34,7 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.sites.updated') | |
| redirect_to :action => :edit, :id => @site | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.sites.update_failure') | |
| render :action => :edit | |
| end | |
app/controllers/cms_admin/snippets_controller.rb
+2
-0
| @@ | @@ -21,6 +21,7 @@ class CmsAdmin::SnippetsController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.snippets.created') | |
| redirect_to :action => :edit, :id => @snippet | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.snippets.creation_failure') | |
| render :action => :new | |
| end | |
| @@ | @@ -30,6 +31,7 @@ class CmsAdmin::SnippetsController < CmsAdmin::BaseController |
| flash[:notice] = I18n.t('cms.snippets.updated') | |
| redirect_to :action => :edit, :id => @snippet | |
| rescue ActiveRecord::RecordInvalid | |
| + | logger.detailed_error($!) |
| flash.now[:error] = I18n.t('cms.snippets.update_failure') | |
| render :action => :edit | |
| end | |
comfortable_mexican_sofa/extensions/rails.rb b/lib/comfortable_mexican_sofa/extensions/rails.rb
+7
-0
| @@ | @@ -14,4 +14,11 @@ module Enumerable |
| end | |
| result | |
| end | |
| + | end |
| + | |
| + | class ActiveSupport::BufferedLogger |
| + | def detailed_error(e) |
| + | error(e.message) |
| + | e.backtrace.each{|line| error line } |
| + | end |
| end | |
| \ No newline at end of file | |