Hello community,
here is the log from the commit of package rubygem-activerecord-4_2 for
openSUSE:Factory checked in at 2015-12-14 10:13:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-08-27 08:57:39.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-activerecord-4_2.new/rubygem-activerecord-4_2.changes
2015-12-14 10:13:35.000000000 +0100
@@ -1,0 +2,108 @@
+Fri Nov 13 05:31:15 UTC 2015 - [email protected]
+
+- updated to version 4.2.5
+ see installed CHANGELOG.md
+
+ ## Rails 4.2.5 (November 12, 2015) ##
+
+ * No longer pass deprecated option `-i` to `pg_dump`.
+
+ *Paul Sadauskas*
+
+ * Set `scope.reordering_value` to `true` if :reordering values are
specified.
+
+ Fixes #21886.
+
+ *Hiroaki Izu*
+
+ * Avoid disabling errors on the PostgreSQL connection when enabling the
+ standard_conforming_strings setting. Errors were previously disabled
because
+ the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
+ versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
+ setting exists. Disabling errors caused problems when using a connection
+ pooling tool like PgBouncer because it's not guaranteed to have the same
+ connection between calls to `execute` and it could leave the connection
+ with errors disabled.
+
+ Fixes #22101.
+
+ *Harry Marr*
+
+ * Includes HABTM returns correct size now. It's caused by the join
dependency
+ only instantiates one HABTM object because the join table hasn't a
primary key.
+
+ Fixes #16032.
+
+ Examples:
+
+ before:
+
+ Project.first.salaried_developers.size # => 3
+
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
+
+ after:
+
+ Project.first.salaried_developers.size # => 3
+
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
+
+ *Bigxiang*
+
+ * Descriptive error message when fixtures contain a missing column.
+
+ Closes #21201.
+
+ *Yves Senn*
+
+ * `bin/rake db:migrate` uses
+ `ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
+ `Migrator.migrations_paths`.
+
+ *Tobias Bielohlawek*
+
+ * Fix `rewhere` in a `has_many` association.
+
+ Fixes #21955.
+
+ *Josh Branchaud*, *Kal*
+
+ * Added run_cmd class method to ActiveRecord::Tasks::DatabaseTasks for
+ drying up Kernel.system() calls within this namespace and to avoid
+ shell expansion by using a paramter list instead of string as arguments
+ for Kernel.system(). Thanks to Nate Berkopec for supply patch to get
+ test units passing.
+
+ *Bryan Paxton*
+
+ * Avoid leaking the first relation we call `first` on, per model.
+
+ Fixes #21921.
+
+ *Matthew Draper*, *Jean Boussier*
+
+ * Allow deserialization of Active Record models that were YAML encoded
prior
+ to Rails 4.2
+
+ *Sean Griffin*
+
+ * Correctly apply `unscope` when preloading through associations.
+
+ *Jimmy Bourassa*
+
+ * Ensure `select` quotes aliased attributes, even when using `from`.
+
+ Fixes #21488
+
+ *Sean Griffin & @johanlunds*
+
+ * Correct query for PostgreSQL 8.2 compatibility.
+
+ *Ben Murphy*, *Matthew Draper*
+
+ * Uniqueness validator raises descriptive error when running on a persisted
+ record without primary key.
+
+ Closes #21304.
+
+ *Yves Senn*
+
+-------------------------------------------------------------------
Old:
----
activerecord-4.2.4.gem
New:
----
activerecord-4.2.5.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-activerecord-4_2.spec ++++++
--- /var/tmp/diff_new_pack.a2jMIA/_old 2015-12-14 10:13:36.000000000 +0100
+++ /var/tmp/diff_new_pack.a2jMIA/_new 2015-12-14 10:13:36.000000000 +0100
@@ -24,7 +24,7 @@
#
Name: rubygem-activerecord-4_2
-Version: 4.2.4
+Version: 4.2.5
Release: 0
%define mod_name activerecord
%define mod_full_name %{mod_name}-%{version}
++++++ activerecord-4.2.4.gem -> activerecord-4.2.5.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2015-08-24 20:23:10.000000000 +0200
+++ new/CHANGELOG.md 2015-11-12 18:04:58.000000000 +0100
@@ -1,3 +1,106 @@
+## Rails 4.2.5 (November 12, 2015) ##
+
+* No longer pass deprecated option `-i` to `pg_dump`.
+
+ *Paul Sadauskas*
+
+* Set `scope.reordering_value` to `true` if :reordering values are specified.
+
+ Fixes #21886.
+
+ *Hiroaki Izu*
+
+* Avoid disabling errors on the PostgreSQL connection when enabling the
+ standard_conforming_strings setting. Errors were previously disabled
because
+ the setting wasn't writable in Postgres 8.1 and didn't exist in earlier
+ versions. Now Rails only supports Postgres 8.2+ we're fine to assume the
+ setting exists. Disabling errors caused problems when using a connection
+ pooling tool like PgBouncer because it's not guaranteed to have the same
+ connection between calls to `execute` and it could leave the connection
+ with errors disabled.
+
+ Fixes #22101.
+
+ *Harry Marr*
+
+* Includes HABTM returns correct size now. It's caused by the join dependency
+ only instantiates one HABTM object because the join table hasn't a primary
key.
+
+ Fixes #16032.
+
+ Examples:
+
+ before:
+
+ Project.first.salaried_developers.size # => 3
+ Project.includes(:salaried_developers).first.salaried_developers.size
# => 1
+
+ after:
+
+ Project.first.salaried_developers.size # => 3
+ Project.includes(:salaried_developers).first.salaried_developers.size
# => 3
+
+ *Bigxiang*
+
+* Descriptive error message when fixtures contain a missing column.
+
+ Closes #21201.
+
+ *Yves Senn*
+
+* `bin/rake db:migrate` uses
+ `ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
+ `Migrator.migrations_paths`.
+
+ *Tobias Bielohlawek*
+
+* Fix `rewhere` in a `has_many` association.
+
+ Fixes #21955.
+
+ *Josh Branchaud*, *Kal*
+
+* Added run_cmd class method to ActiveRecord::Tasks::DatabaseTasks for
+ drying up Kernel.system() calls within this namespace and to avoid
+ shell expansion by using a paramter list instead of string as arguments
+ for Kernel.system(). Thanks to Nate Berkopec for supply patch to get
+ test units passing.
+
+ *Bryan Paxton*
+
+* Avoid leaking the first relation we call `first` on, per model.
+
+ Fixes #21921.
+
+ *Matthew Draper*, *Jean Boussier*
+
+* Allow deserialization of Active Record models that were YAML encoded prior
+ to Rails 4.2
+
+ *Sean Griffin*
+
+* Correctly apply `unscope` when preloading through associations.
+
+ *Jimmy Bourassa*
+
+* Ensure `select` quotes aliased attributes, even when using `from`.
+
+ Fixes #21488
+
+ *Sean Griffin & @johanlunds*
+
+* Correct query for PostgreSQL 8.2 compatibility.
+
+ *Ben Murphy*, *Matthew Draper*
+
+* Uniqueness validator raises descriptive error when running on a persisted
+ record without primary key.
+
+ Closes #21304.
+
+ *Yves Senn*
+
+
## Rails 4.2.4 (August 24, 2015) ##
* Skip statement cache on through association reader.
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_scope.rb
new/lib/active_record/associations/association_scope.rb
--- old/lib/active_record/associations/association_scope.rb 2015-08-24
20:23:10.000000000 +0200
+++ new/lib/active_record/associations/association_scope.rb 2015-11-12
18:04:58.000000000 +0100
@@ -162,10 +162,10 @@
scope.includes! item.includes_values
end
+ scope.unscope!(*item.unscope_values)
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/join_dependency.rb
new/lib/active_record/associations/join_dependency.rb
--- old/lib/active_record/associations/join_dependency.rb 2015-08-24
20:23:10.000000000 +0200
+++ new/lib/active_record/associations/join_dependency.rb 2015-11-12
18:04:58.000000000 +0100
@@ -151,7 +151,8 @@
message_bus.instrument('instantiation.active_record', payload) do
result_set.each { |row_hash|
- parent = parents[row_hash[primary_key]] ||=
join_root.instantiate(row_hash, column_aliases)
+ parent_key = primary_key ? row_hash[primary_key] : row_hash
+ parent = parents[parent_key] ||= join_root.instantiate(row_hash,
column_aliases)
construct(parent, join_root, row_hash, result_set, seen,
model_cache, aliases)
}
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/preloader/association.rb
new/lib/active_record/associations/preloader/association.rb
--- old/lib/active_record/associations/preloader/association.rb 2015-08-24
20:23:10.000000000 +0200
+++ new/lib/active_record/associations/preloader/association.rb 2015-11-12
18:04:58.000000000 +0100
@@ -145,6 +145,10 @@
scope.joins! preload_values[:joins] || values[:joins]
scope.order! preload_values[:order] || values[:order]
+ if preload_values[:reordering] || values[:reordering]
+ scope.reordering_value = true
+ end
+
if preload_values[:readonly] || values[:readonly]
scope.readonly!
end
@@ -153,7 +157,7 @@
scope.where!(klass.table_name => { reflection.type =>
model.base_class.sti_name })
end
- scope.unscope_values = Array(values[:unscope])
+ scope.unscope_values = Array(values[:unscope]) +
Array(preload_values[:unscope])
klass.default_scoped.merge(scope)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/attribute_set/builder.rb
new/lib/active_record/attribute_set/builder.rb
--- old/lib/active_record/attribute_set/builder.rb 2015-08-24
20:23:10.000000000 +0200
+++ new/lib/active_record/attribute_set/builder.rb 2015-11-12
18:04:58.000000000 +0100
@@ -1,3 +1,5 @@
+require 'active_record/attribute'
+
module ActiveRecord
class AttributeSet # :nodoc:
class Builder # :nodoc:
@@ -64,10 +66,29 @@
end
end
+ def ==(other)
+ if other.is_a?(LazyAttributeHash)
+ materialize == other.materialize
+ else
+ materialize == other
+ end
+ end
+
protected
attr_reader :types, :values, :additional_types, :delegate_hash
+ def materialize
+ unless @materialized
+ values.each_key { |key| self[key] }
+ types.each_key { |key| self[key] }
+ unless frozen?
+ @materialized = true
+ end
+ end
+ delegate_hash
+ end
+
private
def assign_default_value(name)
@@ -81,16 +102,5 @@
delegate_hash[name] = Attribute.uninitialized(name, type)
end
end
-
- def materialize
- unless @materialized
- values.each_key { |key| self[key] }
- types.each_key { |key| self[key] }
- unless frozen?
- @materialized = true
- end
- end
- delegate_hash
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/attribute_set.rb
new/lib/active_record/attribute_set.rb
--- old/lib/active_record/attribute_set.rb 2015-08-24 20:23:10.000000000
+0200
+++ new/lib/active_record/attribute_set.rb 2015-11-12 18:04:58.000000000
+0100
@@ -64,6 +64,10 @@
end
end
+ def ==(other)
+ attributes == other.attributes
+ end
+
protected
attr_reader :attributes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/abstract/database_statements.rb
new/lib/active_record/connection_adapters/abstract/database_statements.rb
--- old/lib/active_record/connection_adapters/abstract/database_statements.rb
2015-08-24 20:23:10.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/database_statements.rb
2015-11-12 18:04:58.000000000 +0100
@@ -291,8 +291,12 @@
key_list = []
value_list = fixture.map do |name, value|
- key_list << quote_column_name(name)
- quote(value, columns[name])
+ if column = columns[name]
+ key_list << quote_column_name(name)
+ quote(value, column)
+ else
+ raise Fixture::FixtureError, %(table "#{table_name}" has no column
named "#{name}".)
+ end
end
execute "INSERT INTO #{quote_table_name(table_name)}
(#{key_list.join(', ')}) VALUES (#{value_list.join(', ')})", 'Fixture Insert'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/abstract_adapter.rb
new/lib/active_record/connection_adapters/abstract_adapter.rb
--- old/lib/active_record/connection_adapters/abstract_adapter.rb
2015-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract_adapter.rb
2015-11-12 18:04:59.000000000 +0100
@@ -457,7 +457,6 @@
message = "#{e.class.name}: #{e.message.force_encoding
sql.encoding}: #{sql}"
end
- @logger.error message if @logger
exception = translate_exception(e, message)
exception.set_backtrace e.backtrace
exception
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/connection_adapters/column.rb
new/lib/active_record/connection_adapters/column.rb
--- old/lib/active_record/connection_adapters/column.rb 2015-08-24
20:23:11.000000000 +0200
+++ new/lib/active_record/connection_adapters/column.rb 2015-11-12
18:04:59.000000000 +0100
@@ -31,7 +31,7 @@
# It will be mapped to one of the standard Rails SQL types in the
<tt>type</tt> attribute.
# +null+ determines if this column allows +NULL+ values.
def initialize(name, default, cast_type, sql_type = nil, null = true)
- @name = name
+ @name = name.freeze
@cast_type = cast_type
@sql_type = sql_type
@null = null
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-08-24
20:23:11.000000000 +0200
+++ new/lib/active_record/connection_adapters/mysql2_adapter.rb 2015-11-12
18:04:59.000000000 +0100
@@ -1,6 +1,6 @@
require 'active_record/connection_adapters/abstract_mysql_adapter'
-gem 'mysql2', '~> 0.3.13'
+gem 'mysql2', '>= 0.3.13', '< 0.5'
require 'mysql2'
module ActiveRecord
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
new/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
---
old/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
2015-08-24 20:23:11.000000000 +0200
+++
new/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
2015-11-12 18:04:59.000000000 +0100
@@ -36,7 +36,7 @@
WHERE
t.typname IN (%s)
OR t.typtype IN (%s)
- OR t.typinput::varchar = 'array_in'
+ OR t.typinput = 'array_in(cstring,oid,integer)'::regprocedure
OR t.typelem != 0
SQL
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql/schema_statements.rb
new/lib/active_record/connection_adapters/postgresql/schema_statements.rb
--- old/lib/active_record/connection_adapters/postgresql/schema_statements.rb
2015-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql/schema_statements.rb
2015-11-12 18:04:59.000000000 +0100
@@ -86,7 +86,7 @@
execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
end
- # Returns the list of all tables in the schema search path or a
specified schema.
+ # Returns the list of all tables in the schema search path.
def tables(name = nil)
query(<<-SQL, 'SCHEMA').map { |row| row[0] }
SELECT tablename
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql_adapter.rb
new/lib/active_record/connection_adapters/postgresql_adapter.rb
--- old/lib/active_record/connection_adapters/postgresql_adapter.rb
2015-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql_adapter.rb
2015-11-12 18:04:59.000000000 +0100
@@ -308,12 +308,8 @@
true
end
- # Enable standard-conforming strings if available.
def set_standard_conforming_strings
- old, self.client_min_messages = client_min_messages, 'panic'
- execute('SET standard_conforming_strings = on', 'SCHEMA') rescue nil
- ensure
- self.client_min_messages = old
+ execute('SET standard_conforming_strings = on', 'SCHEMA')
end
def supports_ddl_transactions?
@@ -677,7 +673,7 @@
self.client_min_messages = @config[:min_messages] || 'warning'
self.schema_search_path = @config[:schema_search_path] ||
@config[:schema_order]
- # Use standard-conforming strings if available so we don't have to
do the E'...' dance.
+ # Use standard-conforming strings so we don't have to do the E'...'
dance.
set_standard_conforming_strings
# If using Active Record's time zone support configure the
connection to return
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-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/core.rb 2015-11-12 18:04:59.000000000 +0100
@@ -299,6 +299,7 @@
# post.init_with(coder)
# post.title # => 'hello world'
def init_with(coder)
+ coder = LegacyYamlAdapter.convert(self.class, coder)
@attributes = coder['attributes']
init_internals
@@ -372,6 +373,7 @@
coder['raw_attributes'] = attributes_before_type_cast
coder['attributes'] = @attributes
coder['new_record'] = new_record?
+ coder['active_record_yaml_version'] = 0
end
# Returns true if +comparison_object+ is the same exact object, or
+comparison_object+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/enum.rb
new/lib/active_record/enum.rb
--- old/lib/active_record/enum.rb 2015-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/enum.rb 2015-11-12 18:04:59.000000000 +0100
@@ -18,10 +18,9 @@
# conversation.archived? # => true
# conversation.status # => "archived"
#
- # # conversation.update! status: 1
+ # # conversation.status = 1
# conversation.status = "archived"
#
- # # conversation.update! status: nil
# conversation.status = nil
# conversation.status.nil? # => true
# conversation.status # => nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/errors.rb
new/lib/active_record/errors.rb
--- old/lib/active_record/errors.rb 2015-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/errors.rb 2015-11-12 18:04:59.000000000 +0100
@@ -219,11 +219,12 @@
class UnknownPrimaryKey < ActiveRecordError
attr_reader :model
- def initialize(model)
- super("Unknown primary key for table #{model.table_name} in model
#{model}.")
+ def initialize(model, description = nil)
+ message = "Unknown primary key for table #{model.table_name} in model
#{model}."
+ message += "\n#{description}" if description
+ super(message)
@model = model
end
-
end
# Raised when a relation cannot be mutated because it's already loaded.
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-08-24 20:23:11.000000000
+0200
+++ new/lib/active_record/gem_version.rb 2015-11-12 18:04:59.000000000
+0100
@@ -7,7 +7,7 @@
module VERSION
MAJOR = 4
MINOR = 2
- TINY = 4
+ TINY = 5
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/legacy_yaml_adapter.rb
new/lib/active_record/legacy_yaml_adapter.rb
--- old/lib/active_record/legacy_yaml_adapter.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/active_record/legacy_yaml_adapter.rb 2015-11-12
18:04:59.000000000 +0100
@@ -0,0 +1,30 @@
+module ActiveRecord
+ module LegacyYamlAdapter
+ def self.convert(klass, coder)
+ return coder unless coder.is_a?(Psych::Coder)
+
+ case coder["active_record_yaml_version"]
+ when 0 then coder
+ else
+ if coder["attributes"].is_a?(AttributeSet)
+ coder
+ else
+ Rails41.convert(klass, coder)
+ end
+ end
+ end
+
+ module Rails41
+ def self.convert(klass, coder)
+ attributes = klass.attributes_builder
+ .build_from_database(coder["attributes"])
+ new_record = coder["attributes"][klass.primary_key].blank?
+
+ {
+ "attributes" => attributes,
+ "new_record" => new_record,
+ }
+ end
+ end
+ end
+end
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-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/migration.rb 2015-11-12 18:04:59.000000000 +0100
@@ -420,7 +420,10 @@
new.migrate direction
end
- # Disable DDL transactions for this migration.
+ # Disable the transaction wrapping this migration.
+ # You can still create your own transactions even after calling
#disable_ddl_transaction!
+ #
+ # For more details read the {"Transactional Migrations" section
above}[rdoc-ref:Migration].
def disable_ddl_transaction!
@disable_ddl_transaction = true
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/reflection.rb
new/lib/active_record/reflection.rb
--- old/lib/active_record/reflection.rb 2015-08-24 20:23:11.000000000 +0200
+++ new/lib/active_record/reflection.rb 2015-11-12 18:04:59.000000000 +0100
@@ -32,6 +32,7 @@
end
def self.add_reflection(ar, name, reflection)
+ ar.clear_reflections_cache
ar._reflections = ar._reflections.merge(name.to_s => reflection)
end
@@ -67,16 +68,21 @@
#
# @api public
def reflections
- ref = {}
- _reflections.each do |name, reflection|
- parent_name, parent_reflection = reflection.parent_reflection
- if parent_name
- ref[parent_name] = parent_reflection
- else
- ref[name] = reflection
+ @__reflections ||= begin
+ ref = {}
+
+ _reflections.each do |name, reflection|
+ parent_name, parent_reflection = reflection.parent_reflection
+
+ if parent_name
+ ref[parent_name] = parent_reflection
+ else
+ ref[name] = reflection
+ end
end
+
+ ref
end
- ref
end
# Returns an array of AssociationReflection objects for all the
@@ -116,6 +122,10 @@
def reflect_on_all_autosave_associations
reflections.values.select { |reflection| reflection.options[:autosave]
}
end
+
+ def clear_reflections_cache #:nodoc:
+ @__reflections = nil
+ end
end
# Holds all the methods that are shared between MacroReflection,
AssociationReflection
@@ -161,6 +171,20 @@
macro
end
+
+ def inverse_of
+ return unless inverse_name
+
+ @inverse_of ||= klass._reflect_on_association inverse_name
+ end
+
+ def check_validity_of_inverse!
+ unless polymorphic?
+ if has_inverse? && inverse_of.nil?
+ raise InverseOfAssociationNotFoundError.new(self)
+ end
+ end
+ end
end
# Base class for AggregateReflection and AssociationReflection. Objects of
# AggregateReflection and AssociationReflection are returned by the
Reflection::ClassMethods.
@@ -331,14 +355,6 @@
check_validity_of_inverse!
end
- def check_validity_of_inverse!
- unless polymorphic?
- if has_inverse? && inverse_of.nil?
- raise InverseOfAssociationNotFoundError.new(self)
- end
- end
- end
-
def check_preloadable!
return unless scope
@@ -387,12 +403,6 @@
inverse_name
end
- def inverse_of
- return unless inverse_name
-
- @inverse_of ||= klass._reflect_on_association inverse_name
- end
-
def polymorphic_inverse_of(associated_class)
if has_inverse?
if inverse_relationship =
associated_class._reflect_on_association(options[:inverse_of])
@@ -865,6 +875,8 @@
klass.primary_key || raise(UnknownPrimaryKey.new(klass))
end
+ def inverse_name; delegate_reflection.send(:inverse_name); end
+
private
def derive_class_name
# get the class_name of the belongs_to association of the through
reflection
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-08-24
20:23:11.000000000 +0200
+++ new/lib/active_record/relation/query_methods.rb 2015-11-12
18:04:59.000000000 +0100
@@ -258,7 +258,7 @@
def _select!(*fields) # :nodoc:
fields.flatten!
fields.map! do |field|
- klass.attribute_alias?(field) ? klass.attribute_alias(field) : field
+ klass.attribute_alias?(field) ? klass.attribute_alias(field).to_sym :
field
end
self.select_values += fields
self
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/tasks/database_tasks.rb
new/lib/active_record/tasks/database_tasks.rb
--- old/lib/active_record/tasks/database_tasks.rb 2015-08-24
20:23:11.000000000 +0200
+++ new/lib/active_record/tasks/database_tasks.rb 2015-11-12
18:04:59.000000000 +0100
@@ -134,7 +134,7 @@
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
scope = ENV['SCOPE']
verbose_was, Migration.verbose = Migration.verbose, verbose
- Migrator.migrate(Migrator.migrations_paths, version) do |migration|
+ Migrator.migrate(migrations_paths, version) do |migration|
scope.blank? || scope == migration.scope
end
ensure
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/tasks/mysql_database_tasks.rb
new/lib/active_record/tasks/mysql_database_tasks.rb
--- old/lib/active_record/tasks/mysql_database_tasks.rb 2015-08-24
20:23:11.000000000 +0200
+++ new/lib/active_record/tasks/mysql_database_tasks.rb 2015-11-12
18:04:59.000000000 +0100
@@ -56,21 +56,20 @@
end
def structure_dump(filename)
- args = prepare_command_options('mysqldump')
+ args = prepare_command_options
args.concat(["--result-file", "#{filename}"])
args.concat(["--no-data"])
args.concat(["#{configuration['database']}"])
- unless Kernel.system(*args)
- $stderr.puts "Could not dump the database structure. "\
- "Make sure `mysqldump` is in your PATH and check the
command output for warnings."
- end
+
+ run_cmd('mysqldump', args, 'dumping')
end
def structure_load(filename)
- args = prepare_command_options('mysql')
+ args = prepare_command_options
args.concat(['--execute', %{SET FOREIGN_KEY_CHECKS = 0; SOURCE
#{filename}; SET FOREIGN_KEY_CHECKS = 1}])
args.concat(["--database", "#{configuration['database']}"])
- Kernel.system(*args)
+
+ run_cmd('mysql', args, 'loading')
end
private
@@ -129,8 +128,8 @@
$stdin.gets.strip
end
- def prepare_command_options(command)
- args = [command]
+ def prepare_command_options
+ args = []
args.concat(['--user', configuration['username']]) if
configuration['username']
args << "--password=#{configuration['password']}" if
configuration['password']
args.concat(['--default-character-set', configuration['encoding']]) if
configuration['encoding']
@@ -140,6 +139,17 @@
args
end
+
+ def run_cmd(cmd, args, action)
+ fail run_cmd_error(cmd, args, action) unless Kernel.system(cmd, *args)
+ end
+
+ def run_cmd_error(cmd, args, action)
+ msg = "failed to execute:\n"
+ msg << "#{cmd}"
+ msg << "Please check the output above for any errors and make sure
that `#{cmd}` is installed in your PATH and has proper permissions.\n\n"
+ msg
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/tasks/postgresql_database_tasks.rb
new/lib/active_record/tasks/postgresql_database_tasks.rb
--- old/lib/active_record/tasks/postgresql_database_tasks.rb 2015-08-24
20:23:11.000000000 +0200
+++ new/lib/active_record/tasks/postgresql_database_tasks.rb 2015-11-12
18:04:59.000000000 +0100
@@ -1,5 +1,3 @@
-require 'shellwords'
-
module ActiveRecord
module Tasks # :nodoc:
class PostgreSQLDatabaseTasks # :nodoc:
@@ -46,20 +44,22 @@
def structure_dump(filename)
set_psql_env
+ args = ['-s', '-x', '-O', '-f', filename]
search_path = configuration['schema_search_path']
unless search_path.blank?
- search_path = search_path.split(",").map{|search_path_part|
"--schema=#{Shellwords.escape(search_path_part.strip)}" }.join(" ")
+ args << search_path.split(',').map do |part|
+ "--schema=#{part.strip}"
+ end.join(' ')
end
-
- command = "pg_dump -i -s -x -O -f #{Shellwords.escape(filename)}
#{search_path} #{Shellwords.escape(configuration['database'])}"
- raise 'Error dumping database' unless Kernel.system(command)
-
+ args << configuration['database']
+ run_cmd('pg_dump', args, 'dumping')
File.open(filename, "a") { |f| f << "SET search_path TO
#{connection.schema_search_path};\n\n" }
end
def structure_load(filename)
set_psql_env
- Kernel.system("psql -q -f #{Shellwords.escape(filename)}
#{configuration['database']}")
+ args = [ '-q', '-f', filename, configuration['database'] ]
+ run_cmd('psql', args, 'loading')
end
private
@@ -85,6 +85,17 @@
ENV['PGPASSWORD'] = configuration['password'].to_s if
configuration['password']
ENV['PGUSER'] = configuration['username'].to_s if
configuration['username']
end
+
+ def run_cmd(cmd, args, action)
+ fail run_cmd_error(cmd, args, action) unless Kernel.system(cmd, *args)
+ end
+
+ def run_cmd_error(cmd, args, action)
+ msg = "failed to execute:\n"
+ msg << "#{cmd} #{args.join(' ')}\n\n"
+ msg << "Please check the output above for any errors and make sure
that `#{cmd}` is installed in your PATH and has proper permissions.\n\n"
+ msg
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/type/decimal.rb
new/lib/active_record/type/decimal.rb
--- old/lib/active_record/type/decimal.rb 2015-08-24 20:23:12.000000000
+0200
+++ new/lib/active_record/type/decimal.rb 2015-11-12 18:04:59.000000000
+0100
@@ -14,7 +14,7 @@
private
def cast_value(value)
- case value
+ casted_value = case value
when ::Float
convert_float_to_big_decimal(value)
when ::Numeric, ::String
@@ -26,6 +26,8 @@
cast_value(value.to_s)
end
end
+
+ scale ? casted_value.round(scale) : casted_value
end
def convert_float_to_big_decimal(value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/validations/uniqueness.rb
new/lib/active_record/validations/uniqueness.rb
--- old/lib/active_record/validations/uniqueness.rb 2015-08-24
20:23:12.000000000 +0200
+++ new/lib/active_record/validations/uniqueness.rb 2015-11-12
18:04:59.000000000 +0100
@@ -17,7 +17,13 @@
begin
relation = build_relation(finder_class, table, attribute, value)
- relation =
relation.and(table[finder_class.primary_key.to_sym].not_eq(record.id)) if
record.persisted?
+ if record.persisted?
+ if finder_class.primary_key
+ relation =
relation.and(table[finder_class.primary_key.to_sym].not_eq(record.id))
+ else
+ raise UnknownPrimaryKey.new(finder_class, "Can not validate
uniqueness for persisted record without primary key.")
+ end
+ end
relation = scope_relation(record, table, relation)
relation = finder_class.unscoped.where(relation)
relation = relation.merge(options[:conditions]) if
options[:conditions]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record.rb new/lib/active_record.rb
--- old/lib/active_record.rb 2015-08-24 20:23:10.000000000 +0200
+++ new/lib/active_record.rb 2015-11-12 18:04:58.000000000 +0100
@@ -43,6 +43,7 @@
autoload :Explain
autoload :Inheritance
autoload :Integration
+ autoload :LegacyYamlAdapter
autoload :Migration
autoload :Migrator, 'active_record/migration'
autoload :ModelSchema
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-08-24 20:23:10.000000000 +0200
+++ new/metadata 2015-11-12 18:04:58.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: activerecord
version: !ruby/object:Gem::Version
- version: 4.2.4
+ version: 4.2.5
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2015-08-24 00:00:00.000000000 Z
+date: 2015-11-12 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: activesupport
@@ -16,28 +16,28 @@
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.4
+ version: 4.2.5
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.4
+ version: 4.2.5
- !ruby/object:Gem::Dependency
name: activemodel
requirement: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.4
+ version: 4.2.5
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 4.2.4
+ version: 4.2.5
- !ruby/object:Gem::Dependency
name: arel
requirement: !ruby/object:Gem::Requirement
@@ -194,6 +194,7 @@
- lib/active_record/gem_version.rb
- lib/active_record/inheritance.rb
- lib/active_record/integration.rb
+- lib/active_record/legacy_yaml_adapter.rb
- lib/active_record/locale/en.yml
- lib/active_record/locking/optimistic.rb
- lib/active_record/locking/pessimistic.rb
@@ -303,9 +304,8 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.4.7
+rubygems_version: 2.4.5.1
signing_key:
specification_version: 4
summary: Object-relational mapper framework (part of Rails).
test_files: []
-has_rdoc: