Hello community,
here is the log from the commit of package rubygem-activerecord-4_2 for
openSUSE:Factory checked in at 2015-08-27 08:57:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-activerecord-4_2 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-activerecord-4_2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-activerecord-4_2"
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-activerecord-4_2/rubygem-activerecord-4_2.changes
2015-07-05 18:02:32.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-activerecord-4_2.new/rubygem-activerecord-4_2.changes
2015-08-27 08:57:39.000000000 +0200
@@ -1,0 +2,73 @@
+Tue Aug 25 04:31:14 UTC 2015 - [email protected]
+
+- updated to version 4.2.4
+ see installed CHANGELOG.md
+
+ ## Rails 4.2.4 (August 24, 2015) ##
+
+ * Skip statement cache on through association reader.
+
+ If the through class has default scopes we should skip the statement
+ cache.
+
+ Closes #20745.
+
+ *Rafael Mendonça França*
+
+ * Fixes #19420. When generating schema.rb using Postgres BigInt[] data type
+ the limit: 8 was not coming through. This caused it to become Int[] data
type
+ after doing a rebuild off of schema.rb.
+
+ *Jake Waller*
+
+ * Fix state being carried over from previous transaction.
+
+ Considering the following example where `name` is a required attribute.
+ Before we had `new_record?` returning `true` for a persisted record:
+
+ author = Author.create! name: 'foo'
+ author.name = nil
+ author.save # => false
+ author.new_record? # => true
+
+ Fixes #20824.
+
+ *Roque Pinel*
+
+ * Correctly ignore `mark_for_destruction` when `autosave` isn't set to
`true`
+ when validating associations.
+
+ Fixes #20882.
+
+ *Sean Griffin*
+
+ * Fix through associations using scopes having the scope merged multiple
+ times.
+
+ Fixes #20721.
+ Fixes #20727.
+
+ *Sean Griffin*
+
+ * `ActiveRecord::Base.dump_schema_after_migration` applies migration tasks
+ other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)
+
+ Fixes #20743.
+
+ *Yves Senn*
+
+ * Correctly raise `ActiveRecord::AssociationTypeMismatch` when assigning
+ a wrong type to a namespaced association.
+
+ Fixes #20545.
+
+ *Diego Carrion*
+
+ * Prevent error when using `force_reload: true` on an unassigned
polymorphic
+ belongs_to association.
+
+ Fixes #20426.
+
+ *James Dabbs*
+
+-------------------------------------------------------------------
Old:
----
activerecord-4.2.3.gem
New:
----
activerecord-4.2.4.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-activerecord-4_2.spec ++++++
--- /var/tmp/diff_new_pack.Qju2YE/_old 2015-08-27 08:57:39.000000000 +0200
+++ /var/tmp/diff_new_pack.Qju2YE/_new 2015-08-27 08:57:39.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-activerecord-4_2
-Version: 4.2.3
+Version: 4.2.4
Release: 0
%define mod_name activerecord
%define mod_full_name %{mod_name}-%{version}
++++++ activerecord-4.2.3.gem -> activerecord-4.2.4.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2015-06-25 23:29:22.000000000 +0200
+++ new/CHANGELOG.md 2015-08-24 20:23:10.000000000 +0200
@@ -1,3 +1,71 @@
+## Rails 4.2.4 (August 24, 2015) ##
+
+* Skip statement cache on through association reader.
+
+ If the through class has default scopes we should skip the statement
+ cache.
+
+ Closes #20745.
+
+ *Rafael Mendonça França*
+
+* Fixes #19420. When generating schema.rb using Postgres BigInt[] data type
+ the limit: 8 was not coming through. This caused it to become Int[] data
type
+ after doing a rebuild off of schema.rb.
+
+ *Jake Waller*
+
+* Fix state being carried over from previous transaction.
+
+ Considering the following example where `name` is a required attribute.
+ Before we had `new_record?` returning `true` for a persisted record:
+
+ author = Author.create! name: 'foo'
+ author.name = nil
+ author.save # => false
+ author.new_record? # => true
+
+ Fixes #20824.
+
+ *Roque Pinel*
+
+* Correctly ignore `mark_for_destruction` when `autosave` isn't set to `true`
+ when validating associations.
+
+ Fixes #20882.
+
+ *Sean Griffin*
+
+* Fix through associations using scopes having the scope merged multiple
+ times.
+
+ Fixes #20721.
+ Fixes #20727.
+
+ *Sean Griffin*
+
+* `ActiveRecord::Base.dump_schema_after_migration` applies migration tasks
+ other than `db:migrate`. (eg. `db:rollback`, `db:migrate:dup`, ...)
+
+ Fixes #20743.
+
+ *Yves Senn*
+
+* Correctly raise `ActiveRecord::AssociationTypeMismatch` when assigning
+ a wrong type to a namespaced association.
+
+ Fixes #20545.
+
+ *Diego Carrion*
+
+* Prevent error when using `force_reload: true` on an unassigned polymorphic
+ belongs_to association.
+
+ Fixes #20426.
+
+ *James Dabbs*
+
+
## Rails 4.2.3 (June 25, 2015) ##
* Let `WITH` queries (Common Table Expressions) be explainable.
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/associations/association.rb
new/lib/active_record/associations/association.rb
--- old/lib/active_record/associations/association.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/associations/association.rb 2015-08-24
20:23:10.000000000 +0200
@@ -211,9 +211,12 @@
# the kind of the class of the associated objects. Meant to be used as
# a sanity check when you are about to assign an associated record.
def raise_on_type_mismatch!(record)
- unless record.is_a?(reflection.klass) ||
record.is_a?(reflection.class_name.constantize)
- message =
"#{reflection.class_name}(##{reflection.klass.object_id}) expected, got
#{record.class}(##{record.class.object_id})"
- raise ActiveRecord::AssociationTypeMismatch, message
+ unless record.is_a?(reflection.klass)
+ fresh_class = reflection.class_name.safe_constantize
+ unless fresh_class && record.is_a?(fresh_class)
+ message =
"#{reflection.class_name}(##{reflection.klass.object_id}) expected, got
#{record.class}(##{record.class.object_id})"
+ raise ActiveRecord::AssociationTypeMismatch, message
+ end
end
end
@@ -248,6 +251,15 @@
initialize_attributes(record)
end
end
+
+ # Returns true if statement cache should be skipped on the association
reader.
+ def skip_statement_cache?
+ reflection.scope_chain.any?(&:any?) ||
+ scope.eager_loading? ||
+ klass.current_scope ||
+ klass.default_scopes.any? ||
+ reflection.source_reflection.active_record.default_scopes.any?
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/associations/association_scope.rb
new/lib/active_record/associations/association_scope.rb
--- old/lib/active_record/associations/association_scope.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/associations/association_scope.rb 2015-08-24
20:23:10.000000000 +0200
@@ -165,6 +165,7 @@
scope.where_values += item.where_values
scope.bind_values += item.bind_values
scope.order_values |= item.order_values
+ scope.unscope!(*item.unscope_values)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/builder/has_and_belongs_to_many.rb
new/lib/active_record/associations/builder/has_and_belongs_to_many.rb
--- old/lib/active_record/associations/builder/has_and_belongs_to_many.rb
2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/associations/builder/has_and_belongs_to_many.rb
2015-08-24 20:23:10.000000000 +0200
@@ -46,7 +46,7 @@
join_model = Class.new(ActiveRecord::Base) {
class << self;
- attr_accessor :class_resolver
+ attr_accessor :left_model
attr_accessor :name
attr_accessor :table_name_resolver
attr_accessor :left_reflection
@@ -58,7 +58,7 @@
end
def self.compute_type(class_name)
- class_resolver.compute_type class_name
+ left_model.compute_type class_name
end
def self.add_left_association(name, options)
@@ -72,11 +72,15 @@
self.right_reflection = _reflect_on_association(rhs_name)
end
+ def self.retrieve_connection
+ left_model.retrieve_connection
+ end
+
}
join_model.name =
"HABTM_#{association_name.to_s.camelize}"
join_model.table_name_resolver = habtm
- join_model.class_resolver = lhs_model
+ join_model.left_model = lhs_model
join_model.add_left_association :left_side, anonymous_class: lhs_model
join_model.add_right_association association_name,
belongs_to_options(options)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/collection_association.rb
new/lib/active_record/associations/collection_association.rb
--- old/lib/active_record/associations/collection_association.rb
2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/associations/collection_association.rb
2015-08-24 20:23:10.000000000 +0200
@@ -431,13 +431,7 @@
private
def get_records
- if reflection.scope_chain.any?(&:any?) ||
- scope.eager_loading? ||
- klass.current_scope ||
- klass.default_scopes.any?
-
- return scope.to_a
- end
+ return scope.to_a if skip_statement_cache?
conn = klass.connection
sc = reflection.association_scope_cache(conn, owner) do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/has_many_association.rb
new/lib/active_record/associations/has_many_association.rb
--- old/lib/active_record/associations/has_many_association.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/associations/has_many_association.rb 2015-08-24
20:23:10.000000000 +0200
@@ -80,8 +80,15 @@
[association_scope.limit_value, count].compact.min
end
+
+ # Returns whether a counter cache should be used for this association.
+ #
+ # The counter_cache option must be given on either the owner or inverse
+ # association, and the column must be present on the owner.
def has_cached_counter?(reflection = reflection())
- owner.attribute_present?(cached_counter_attribute_name(reflection))
+ if reflection.options[:counter_cache] || (inverse =
inverse_which_updates_counter_cache(reflection)) &&
inverse.options[:counter_cache]
+ owner.attribute_present?(cached_counter_attribute_name(reflection))
+ end
end
def cached_counter_attribute_name(reflection = reflection())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/has_many_through_association.rb
new/lib/active_record/associations/has_many_through_association.rb
--- old/lib/active_record/associations/has_many_through_association.rb
2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/associations/has_many_through_association.rb
2015-08-24 20:23:10.000000000 +0200
@@ -162,7 +162,7 @@
count = scope.destroy_all.length
else
scope.each do |record|
- record.run_callbacks :destroy
+ record._run_destroy_callbacks
end
arel = scope.arel
@@ -229,6 +229,10 @@
false
end
+ def has_cached_counter?(reflection = reflection())
+ owner.attribute_present?(cached_counter_attribute_name(reflection))
+ end
+
def through_reflection_updates_counter_cache?
counter_name = cached_counter_attribute_name
inverse_updates_counter_named?(counter_name, through_reflection)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/associations/preloader.rb
new/lib/active_record/associations/preloader.rb
--- old/lib/active_record/associations/preloader.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/associations/preloader.rb 2015-08-24
20:23:10.000000000 +0200
@@ -10,13 +10,13 @@
# end
#
# class Book < ActiveRecord::Base
- # # columns: title, sales
+ # # columns: title, sales, author_id
# end
#
# When you load an author with all associated books Active Record will make
# multiple queries like this:
#
- # Author.includes(:books).where(:name => ['bell hooks', 'Homer').to_a
+ # Author.includes(:books).where(name: ['bell hooks', 'Homer']).to_a
#
# => SELECT `authors`.* FROM `authors` WHERE `name` IN ('bell hooks',
'Homer')
# => SELECT `books`.* FROM `books` WHERE `author_id` IN (2, 5)
@@ -160,7 +160,7 @@
h
end
- class AlreadyLoaded
+ class AlreadyLoaded # :nodoc:
attr_reader :owners, :reflection
def initialize(klass, owners, reflection, preload_scope)
@@ -175,7 +175,7 @@
end
end
- class NullPreloader
+ class NullPreloader # :nodoc:
def self.new(klass, owners, reflection, preload_scope); self; end
def self.run(preloader); end
def self.preloaded_records; []; end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/singular_association.rb
new/lib/active_record/associations/singular_association.rb
--- old/lib/active_record/associations/singular_association.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/associations/singular_association.rb 2015-08-24
20:23:10.000000000 +0200
@@ -3,7 +3,7 @@
class SingularAssociation < Association #:nodoc:
# Implements the reader method, e.g. foo.bar for Foo.has_one :bar
def reader(force_reload = false)
- if force_reload
+ if force_reload && klass
klass.uncached { reload }
elsif !loaded? || stale_target?
reload
@@ -39,13 +39,7 @@
end
def get_records
- if reflection.scope_chain.any?(&:any?) ||
- scope.eager_loading? ||
- klass.current_scope ||
- klass.default_scopes.any?
-
- return scope.limit(1).to_a
- end
+ return scope.limit(1).to_a if skip_statement_cache?
conn = klass.connection
sc = reflection.association_scope_cache(conn, owner) do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/through_association.rb
new/lib/active_record/associations/through_association.rb
--- old/lib/active_record/associations/through_association.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/associations/through_association.rb 2015-08-24
20:23:10.000000000 +0200
@@ -15,12 +15,6 @@
scope = super
reflection.chain.drop(1).each do |reflection|
relation = reflection.klass.all
-
- reflection_scope = reflection.scope
- if reflection_scope && reflection_scope.arity.zero?
- relation = relation.merge(reflection_scope)
- end
-
scope.merge!(
relation.except(:select, :create_with, :includes, :preload,
:joins, :eager_load)
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/autosave_association.rb
new/lib/active_record/autosave_association.rb
--- old/lib/active_record/autosave_association.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/autosave_association.rb 2015-08-24
20:23:10.000000000 +0200
@@ -318,7 +318,7 @@
# the parent, <tt>self</tt>, if it wasn't. Skips any <tt>:autosave</tt>
# enabled records if they're marked_for_destruction? or destroyed.
def association_valid?(reflection, record)
- return true if record.destroyed? || record.marked_for_destruction?
+ return true if record.destroyed? || (reflection.options[:autosave] &&
record.marked_for_destruction?)
validation_context = self.validation_context unless [:create,
:update].include?(self.validation_context)
unless valid = record.valid?(validation_context)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/callbacks.rb
new/lib/active_record/callbacks.rb
--- old/lib/active_record/callbacks.rb 2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/callbacks.rb 2015-08-24 20:23:10.000000000 +0200
@@ -289,25 +289,25 @@
end
def destroy #:nodoc:
- run_callbacks(:destroy) { super }
+ _run_destroy_callbacks { super }
end
def touch(*) #:nodoc:
- run_callbacks(:touch) { super }
+ _run_touch_callbacks { super }
end
private
def create_or_update #:nodoc:
- run_callbacks(:save) { super }
+ _run_save_callbacks { super }
end
def _create_record #:nodoc:
- run_callbacks(:create) { super }
+ _run_create_callbacks { super }
end
def _update_record(*) #:nodoc:
- run_callbacks(:update) { super }
+ _run_update_callbacks { super }
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/abstract/connection_pool.rb
new/lib/active_record/connection_adapters/abstract/connection_pool.rb
--- old/lib/active_record/connection_adapters/abstract/connection_pool.rb
2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/connection_pool.rb
2015-08-24 20:23:10.000000000 +0200
@@ -361,7 +361,7 @@
synchronize do
owner = conn.owner
- conn.run_callbacks :checkin do
+ conn._run_checkin_callbacks do
conn.expire
end
@@ -452,7 +452,7 @@
end
def checkout_and_verify(c)
- c.run_callbacks :checkout do
+ c._run_checkout_callbacks do
c.verify!
end
c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/abstract/schema_statements.rb
new/lib/active_record/connection_adapters/abstract/schema_statements.rb
--- old/lib/active_record/connection_adapters/abstract/schema_statements.rb
2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/schema_statements.rb
2015-08-24 20:23:11.000000000 +0200
@@ -802,7 +802,10 @@
end
def foreign_key_column_for(table_name) # :nodoc:
- "#{table_name.to_s.singularize}_id"
+ prefix = Base.table_name_prefix
+ suffix = Base.table_name_suffix
+ name = table_name.to_s =~ /#{prefix}(.+)#{suffix}/ ? $1 :
table_name.to_s
+ "#{name.singularize}_id"
end
def dump_schema_information #:nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/mysql2_adapter.rb
new/lib/active_record/connection_adapters/mysql2_adapter.rb
--- old/lib/active_record/connection_adapters/mysql2_adapter.rb 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/mysql2_adapter.rb 2015-08-24
20:23:11.000000000 +0200
@@ -271,7 +271,7 @@
end
def full_version
- @full_version ||= @connection.info[:version]
+ @full_version ||= @connection.server_info[:version]
end
def set_field_encoding field_name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql/oid/array.rb
new/lib/active_record/connection_adapters/postgresql/oid/array.rb
--- old/lib/active_record/connection_adapters/postgresql/oid/array.rb
2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql/oid/array.rb
2015-08-24 20:23:11.000000000 +0200
@@ -18,7 +18,7 @@
end
attr_reader :subtype, :delimiter
- delegate :type, to: :subtype
+ delegate :type, :limit, to: :subtype
def initialize(subtype, delimiter = ',')
@subtype = subtype
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/core.rb
new/lib/active_record/core.rb
--- old/lib/active_record/core.rb 2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/core.rb 2015-08-24 20:23:11.000000000 +0200
@@ -281,7 +281,7 @@
init_attributes(attributes, options) if attributes
yield self if block_given?
- run_callbacks :initialize
+ _run_initialize_callbacks
end
# Initialize an empty model object from +coder+. +coder+ should be
@@ -307,8 +307,8 @@
self.class.define_attribute_methods
- run_callbacks :find
- run_callbacks :initialize
+ _run_find_callbacks
+ _run_initialize_callbacks
self
end
@@ -344,7 +344,7 @@
@attributes = @attributes.dup
@attributes.reset(self.class.primary_key)
- run_callbacks(:initialize)
+ _run_initialize_callbacks
@aggregation_cache = {}
@association_cache = {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/gem_version.rb
new/lib/active_record/gem_version.rb
--- old/lib/active_record/gem_version.rb 2015-06-25 23:29:22.000000000
+0200
+++ new/lib/active_record/gem_version.rb 2015-08-24 20:23:11.000000000
+0200
@@ -7,7 +7,7 @@
module VERSION
MAJOR = 4
MINOR = 2
- TINY = 3
+ TINY = 4
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/migration.rb
new/lib/active_record/migration.rb
--- old/lib/active_record/migration.rb 2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/migration.rb 2015-08-24 20:23:11.000000000 +0200
@@ -652,7 +652,8 @@
unless @connection.respond_to? :revert
unless arguments.empty? || [:execute, :enable_extension,
:disable_extension].include?(method)
arguments[0] = proper_table_name(arguments.first,
table_name_options)
- if [:rename_table, :add_foreign_key].include?(method)
+ if [:rename_table, :add_foreign_key].include?(method) ||
+ (method == :remove_foreign_key && !arguments.second.is_a?(Hash))
arguments[1] = proper_table_name(arguments.second,
table_name_options)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/model_schema.rb
new/lib/active_record/model_schema.rb
--- old/lib/active_record/model_schema.rb 2015-06-25 23:29:22.000000000
+0200
+++ new/lib/active_record/model_schema.rb 2015-08-24 20:23:11.000000000
+0200
@@ -295,7 +295,7 @@
def reset_column_information
connection.clear_cache!
undefine_attribute_methods
- connection.schema_cache.clear_table_cache!(table_name) if table_exists?
+ connection.schema_cache.clear_table_cache!(table_name)
@arel_engine = nil
@column_names = nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/railtie.rb
new/lib/active_record/railtie.rb
--- old/lib/active_record/railtie.rb 2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/railtie.rb 2015-08-24 20:23:11.000000000 +0200
@@ -147,8 +147,8 @@
ActiveSupport.on_load(:active_record) do
ActionDispatch::Reloader.send(hook) do
if ActiveRecord::Base.connected?
- ActiveRecord::Base.clear_reloadable_connections!
ActiveRecord::Base.clear_cache!
+ ActiveRecord::Base.clear_reloadable_connections!
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/railties/databases.rake
new/lib/active_record/railties/databases.rake
--- old/lib/active_record/railties/databases.rake 2015-06-25
23:29:22.000000000 +0200
+++ new/lib/active_record/railties/databases.rake 2015-08-24
20:23:11.000000000 +0200
@@ -42,15 +42,18 @@
desc "Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)."
task :migrate => [:environment, :load_config] do
ActiveRecord::Tasks::DatabaseTasks.migrate
- db_namespace['_dump'].invoke if
ActiveRecord::Base.dump_schema_after_migration
+ db_namespace['_dump'].invoke
end
+ # IMPORTANT: This task won't dump the schema if
ActiveRecord::Base.dump_schema_after_migration is set to false
task :_dump do
- case ActiveRecord::Base.schema_format
- when :ruby then db_namespace["schema:dump"].invoke
- when :sql then db_namespace["structure:dump"].invoke
- else
- raise "unknown schema format #{ActiveRecord::Base.schema_format}"
+ if ActiveRecord::Base.dump_schema_after_migration
+ case ActiveRecord::Base.schema_format
+ when :ruby then db_namespace["schema:dump"].invoke
+ when :sql then db_namespace["structure:dump"].invoke
+ else
+ raise "unknown schema format #{ActiveRecord::Base.schema_format}"
+ end
end
# Allow this task to be called as many times as required. An example is the
# migrate:redo task, which calls other two internally that depend on this
one.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/relation/merger.rb
new/lib/active_record/relation/merger.rb
--- old/lib/active_record/relation/merger.rb 2015-06-25 23:29:23.000000000
+0200
+++ new/lib/active_record/relation/merger.rb 2015-08-24 20:23:11.000000000
+0200
@@ -51,7 +51,8 @@
NORMAL_VALUES = Relation::SINGLE_VALUE_METHODS +
Relation::MULTI_VALUE_METHODS -
- [:joins, :where, :order, :bind, :reverse_order, :lock,
:create_with, :reordering, :from] # :nodoc:
+ [:includes, :preload, :joins, :where, :order, :bind,
:reverse_order, :lock, :create_with, :reordering, :from] # :nodoc:
+
def normal_values
NORMAL_VALUES
@@ -75,6 +76,7 @@
merge_multi_values
merge_single_values
+ merge_preloads
merge_joins
relation
@@ -82,6 +84,27 @@
private
+ def merge_preloads
+ return if other.preload_values.empty? && other.includes_values.empty?
+
+ if other.klass == relation.klass
+ relation.preload!(*other.preload_values) unless
other.preload_values.empty?
+ relation.includes!(other.includes_values) unless
other.includes_values.empty?
+ else
+ reflection = relation.klass.reflect_on_all_associations.find do |r|
+ r.class_name == other.klass.name
+ end || return
+
+ unless other.preload_values.empty?
+ relation.preload! reflection.name => other.preload_values
+ end
+
+ unless other.includes_values.empty?
+ relation.includes! reflection.name => other.includes_values
+ end
+ end
+ end
+
def merge_joins
return if other.joins_values.blank?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/relation/query_methods.rb
new/lib/active_record/relation/query_methods.rb
--- old/lib/active_record/relation/query_methods.rb 2015-06-25
23:29:23.000000000 +0200
+++ new/lib/active_record/relation/query_methods.rb 2015-08-24
20:23:11.000000000 +0200
@@ -907,7 +907,7 @@
def where_unscoping(target_value)
target_value = target_value.to_s
- where_values.reject! do |rel|
+ self.where_values = where_values.reject do |rel|
case rel
when Arel::Nodes::Between, Arel::Nodes::In, Arel::Nodes::NotIn,
Arel::Nodes::Equality, Arel::Nodes::NotEqual, Arel::Nodes::LessThan,
Arel::Nodes::LessThanOrEqual, Arel::Nodes::GreaterThan,
Arel::Nodes::GreaterThanOrEqual
subrelation = (rel.left.kind_of?(Arel::Attributes::Attribute) ?
rel.left : rel.right)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/relation.rb
new/lib/active_record/relation.rb
--- old/lib/active_record/relation.rb 2015-06-25 23:29:22.000000000 +0200
+++ new/lib/active_record/relation.rb 2015-08-24 20:23:11.000000000 +0200
@@ -474,7 +474,8 @@
stmt.wheres = arel.constraints
end
- affected = @klass.connection.delete(stmt, 'SQL', bind_values)
+ bvs = arel.bind_values + bind_values
+ affected = @klass.connection.delete(stmt, 'SQL', bvs)
reset
affected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/scoping/default.rb
new/lib/active_record/scoping/default.rb
--- old/lib/active_record/scoping/default.rb 2015-06-25 23:29:23.000000000
+0200
+++ new/lib/active_record/scoping/default.rb 2015-08-24 20:23:11.000000000
+0200
@@ -95,6 +95,7 @@
end
def build_default_scope(base_rel = relation) # :nodoc:
+ return if abstract_class?
if !Base.is_a?(method(:default_scope).owner)
# The user has defined their own default scope method, so call that
evaluate_default_scope { default_scope }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/transactions.rb
new/lib/active_record/transactions.rb
--- old/lib/active_record/transactions.rb 2015-06-25 23:29:23.000000000
+0200
+++ new/lib/active_record/transactions.rb 2015-08-24 20:23:11.000000000
+0200
@@ -311,7 +311,7 @@
# Ensure that it is not called if the object was never persisted (failed
create),
# but call it after the commit of a destroyed object.
def committed!(should_run_callbacks = true) #:nodoc:
- run_callbacks(:commit) if should_run_callbacks && destroyed? ||
persisted?
+ _run_commit_callbacks if should_run_callbacks && destroyed? || persisted?
ensure
force_clear_transaction_record_state
end
@@ -319,7 +319,7 @@
# Call the +after_rollback+ callbacks. The +force_restore_state+ argument
indicates if the record
# state should be rolled back to the beginning or just to the last
savepoint.
def rolledback!(force_restore_state = false, should_run_callbacks = true)
#:nodoc:
- run_callbacks(:rollback) if should_run_callbacks
+ _run_rollback_callbacks if should_run_callbacks
ensure
restore_transaction_record_state(force_restore_state)
clear_transaction_record_state
@@ -357,6 +357,10 @@
raise ActiveRecord::Rollback unless status
end
status
+ ensure
+ if @transaction_state && @transaction_state.committed?
+ clear_transaction_record_state
+ end
end
protected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-06-25 23:29:22.000000000 +0200
+++ new/metadata 2015-08-24 20:23:10.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: activerecord
version: !ruby/object:Gem::Version
- version: 4.2.3
+ version: 4.2.4
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2015-06-25 00:00:00.000000000 Z
+date: 2015-08-24 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: activesupport
@@ -16,28 +16,28 @@
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.3
+ version: 4.2.4
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.3
+ version: 4.2.4
- !ruby/object:Gem::Dependency
name: activemodel
requirement: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.3
+ version: 4.2.4
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.3
+ version: 4.2.4
- !ruby/object:Gem::Dependency
name: arel
requirement: !ruby/object:Gem::Requirement
@@ -303,8 +303,9 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.4.5
+rubygems_version: 2.4.7
signing_key:
specification_version: 4
summary: Object-relational mapper framework (part of Rails).
test_files: []
+has_rdoc: