Permalink
Browse files

Merge pull request #320 from blj/319-preview

Removed nested transaction which always commits page change on preview, Fixes GH-319
  • Loading branch information...
2 parents 784e60a + ddaa143 commit dd27da802477c5bb8f85988be44b002da849905e @saturnflyer saturnflyer committed Feb 17, 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 dd27da8

Please sign in to comment.