Permalink
Browse files

Removed nested transaction which always commits page change on previe…

…w, Fixes GH-319
  • Loading branch information...
1 parent df0c981 commit 133ddae8f8b0f2f9a5873d55788fed7b7627683c @blj blj committed Feb 10, 2012
Showing with 11 additions and 13 deletions.
  1. +11 −13 app/controllers/admin/pages_controller.rb
@@ -55,20 +55,18 @@ def model_class
def render_preview
Page.transaction do
- PagePart.transaction do
- page_class = Page.descendants.include?(model_class) ? model_class : Page
- if request.referer =~ %r{/admin/pages/(\d+)/edit}
- page = Page.find($1).becomes(page_class)
- page.update_attributes(params[:page])
- page.published_at ||= Time.now
- else
- page = page_class.new(params[:page])
- page.published_at = page.updated_at = page.created_at = Time.now
- page.parent = Page.find($1) if request.referer =~ %r{/admin/pages/(\d+)/children/new}
- end
- page.pagination_parameters = pagination_parameters
- process_with_exception(page)
+ page_class = Page.descendants.include?(model_class) ? model_class : Page
+ if request.referer =~ %r{/admin/pages/(\d+)/edit}
+ page = Page.find($1).becomes(page_class)
+ page.update_attributes(params[:page])
+ page.published_at ||= Time.now
+ else
+ page = page_class.new(params[:page])
+ page.published_at = page.updated_at = page.created_at = Time.now
+ page.parent = Page.find($1) if request.referer =~ %r{/admin/pages/(\d+)/children/new}
end
+ page.pagination_parameters = pagination_parameters
+ process_with_exception(page)
end
end

0 comments on commit 133ddae

Please sign in to comment.