Skip to content

Instantly share code, notes, and snippets.

@jbourassa
Created March 20, 2013 15:46
Show Gist options
  • Save jbourassa/5205760 to your computer and use it in GitHub Desktop.
Save jbourassa/5205760 to your computer and use it in GitHub Desktop.
Attempt to fix page preview in RefineryCMS after PullRequest #2089
diff --git a/app/decorators/controllers/refinery/pages/admin/preview_controller_decorator.rb b/app/decorators/controllers/refinery/pages/admin/preview_controller_decorator.rb
index 97b985b..06fb8fc 100644
--- a/app/decorators/controllers/refinery/pages/admin/preview_controller_decorator.rb
+++ b/app/decorators/controllers/refinery/pages/admin/preview_controller_decorator.rb
@@ -2,4 +2,29 @@ Refinery::Pages::Admin::PreviewController.class_eval do
+
+ def home
+ render_with_templates?
+ end
+
+ def show
+ if respond_to?(params[:path])
+ with_action_name(params[:path]) do
+ run_callbacks(:process_action, params[:path]) { self.send(params[:path]) }
+ end
+ end
+ render_with_templates? unless performed?
+ end
+
+
+ private
+
+ def with_action_name(name)
+ prev_action_name = action_name
+ yield
+ ensure
+
+ self.action_name = prev_action_name
+ end
+
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment