Compare commits

...

7 Commits

Author SHA1 Message Date
Charlie Somerville
b6f150c40c 3.2.19.github7 2014-10-07 16:41:52 +11:00
Charlie Somerville
76ad4030e5 whoops, we don't want to create an output_buffer local 2014-10-07 16:35:37 +11:00
Charlie Somerville
0a3c7ba903 3.2.19.github6 2014-10-07 16:29:46 +11:00
Charlie Somerville
d69e65ab34 use bytesize and byteslice rather than length and slice! 2014-10-07 16:29:14 +11:00
Charlie Somerville
56d2614309 3.2.19.github5 2014-09-26 16:58:46 +10:00
Rob Sanheim
0afd326c36 Move commit exception handling to a method so we can override
It looks like these methods all get included into the AbstractAdapter,
and then in github/github we have our own Adapter as an internal gem.

So this should be easy enough to override in our vendor'ed adapter.

This will allow us to still grab errors that happen in `after_commit`
which would normally be swallowed in Rails 3.0 (and beyond).

Conflicts:
	activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
2014-09-26 16:25:08 +10:00
Rob Sanheim
c957f5f609 only _run_commit_callbacks when destroyed or persisted:
should fix issues with commit callbacks getting called when the record
is not persisted (yet) in a inner transaction or due to some other edge
case.

see also caabed6c76

Conflicts:
	activerecord/lib/active_record/transactions.rb
2014-09-26 16:19:59 +10:00
4 changed files with 14 additions and 8 deletions

View File

@@ -1 +1 @@
3.2.19.github4
3.2.19.github7

View File

@@ -2,11 +2,11 @@ module ActionView
# = Action View Cache Helper
module Helpers
module CacheHelper
# This helper exposes a method for caching fragments of a view
# This helper exposes a method for caching fragments of a view
# rather than an entire action or page. This technique is useful
# caching pieces like menus, lists of newstopics, static HTML
# fragments, and so on. This method takes a block that contains
# the content you wish to cache.
# the content you wish to cache.
#
# See ActionController::Caching::Fragments for usage instructions.
#
@@ -23,7 +23,7 @@ module ActionView
# <p>Hello users! Welcome to our website!</p>
# <% end %>
#
# Static content with embedded ruby content can be cached as
# Static content with embedded ruby content can be cached as
# well:
#
# <% cache do %>
@@ -49,10 +49,11 @@ module ActionView
else
# VIEW TODO: Make #capture usable outside of ERB
# This dance is needed because Builder can't use capture
pos = output_buffer.length
pos = output_buffer.bytesize
yield
output_safe = output_buffer.html_safe?
fragment = output_buffer.slice!(pos..-1)
fragment = output_buffer.byteslice(pos..-1)
self.output_buffer = output_buffer.byteslice(0...pos)
if output_safe
self.output_buffer = output_buffer.class.new(output_buffer)
end

View File

@@ -371,7 +371,7 @@ module ActiveRecord
begin
record.committed!
rescue Exception => e
record.logger.error(e) if record.respond_to?(:logger) && record.logger
handle_commit_exceptions(record, e)
end
end
end
@@ -385,6 +385,11 @@ module ActiveRecord
row = result.rows.first
row && row.first
end
# Handle any exceptions caught trying to send the commit message to a record
def handle_commit_exceptions(record, e)
record.logger.error(e) if record.respond_to?(:logger) && record.logger
end
end
end
end

View File

@@ -278,7 +278,7 @@ module ActiveRecord
# Call the after_commit callbacks
def committed! #:nodoc:
run_callbacks :commit
run_callbacks :commit if destroyed? || persisted?
ensure
@_start_transaction_state.clear
end