activerecord 4.1.11 → 4.1.12.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4106cf0fd6715e3821af907c1cc47c62ec583198
4
- data.tar.gz: 1a8c01a6c859c8d7c58a3096358e51fdbcdf42d0
3
+ metadata.gz: 842637e5210dd7f77e86cfaa9ad1790f47ac4d17
4
+ data.tar.gz: 026a284b043458a834af79ded79e30405faaad2a
5
5
  SHA512:
6
- metadata.gz: 8e08583182000f7cd45f49587bc1e01540747f72de1a4496bdb493484fcdd654e06c4a0a31bc160f67381ebe953e9b7ca0e20680c657b4b2e790eb73aeb27dd4
7
- data.tar.gz: 0571b483403d1564d13ce17785edf6647148f24614ebb0e2fb39a2ef3d0f8405df4ecfee59e25226541572061d5bdabb75316e2477336449d5219f947f624ead
6
+ metadata.gz: ea74b70bc884a0efeb9e29b11d1471d89b7817bfe4df049afc3be902b0f645fbc979699d727b9a54bd7ff8dc91dd3eab0de79fff809e0a093b9433ba877f2c07
7
+ data.tar.gz: 393d8686f2f6e7fa1af7296a356deed8f603ae52b0b940c1cad3bd00d2daf7cdfbbeec000565e7ccaaee9519ade8d866555ff6d3569e3ac451f2843816d56031
@@ -1,3 +1,31 @@
1
+ ## Rails 4.1.12 (June 22, 2015) ##
2
+
3
+ * Raises the right exception when declares a has many through
4
+ association with missing source.
5
+
6
+ *Mauro George*
7
+
8
+ * Revert behavior of `db:schema:load` back to loading the full
9
+ environment. This ensures that initializers are run.
10
+
11
+ Fixes #19545.
12
+
13
+ *Yves Senn*
14
+
15
+ * Rename `:class` to `:anonymous_class` in association options.
16
+
17
+ Fixes #19659.
18
+
19
+ *Andrew White*
20
+
21
+ * Fix referencing wrong table aliases while joining tables of has many through
22
+ association (only when calling calculation methods).
23
+
24
+ Fixes #19276.
25
+
26
+ *pinglamb*
27
+
28
+
1
29
  ## Rails 4.1.11 (June 16, 2015) ##
2
30
 
3
31
  * No changes.
@@ -50,6 +50,7 @@ module ActiveRecord
50
50
  autoload :QueryCache
51
51
  autoload :Querying
52
52
  autoload :ReadonlyAttributes
53
+ autoload :RecordInvalid, 'active_record/validations'
53
54
  autoload :Reflection
54
55
  autoload :RuntimeRegistry
55
56
  autoload :Sanitization
@@ -21,7 +21,7 @@ module ActiveRecord::Associations::Builder
21
21
  end
22
22
  self.extensions = []
23
23
 
24
- self.valid_options = [:class_name, :class, :foreign_key, :validate]
24
+ self.valid_options = [:class_name, :anonymous_class, :foreign_key, :validate]
25
25
 
26
26
  attr_reader :name, :scope, :options
27
27
 
@@ -87,7 +87,7 @@ module ActiveRecord::Associations::Builder
87
87
  join_model.table_name_resolver = habtm
88
88
  join_model.class_resolver = lhs_model
89
89
 
90
- join_model.add_left_association :left_side, class: lhs_model
90
+ join_model.add_left_association :left_side, anonymous_class: lhs_model
91
91
  join_model.add_right_association association_name, belongs_to_options(options)
92
92
  join_model
93
93
  end
@@ -107,7 +107,7 @@ module ActiveRecord::Associations::Builder
107
107
 
108
108
  def middle_options(join_model)
109
109
  middle_options = {}
110
- middle_options[:class] = join_model
110
+ middle_options[:anonymous_class] = join_model
111
111
  middle_options[:source] = join_model.left_reflection.name
112
112
  if options.key? :foreign_key
113
113
  middle_options[:foreign_key] = options[:foreign_key]
@@ -84,7 +84,7 @@ module ActiveRecord
84
84
 
85
85
  def undefine_attribute_methods # :nodoc:
86
86
  generated_attribute_methods.synchronize do
87
- super if @attribute_methods_generated
87
+ super if defined?(@attribute_methods_generated) && @attribute_methods_generated
88
88
  @attribute_methods_generated = false
89
89
  end
90
90
  end
@@ -57,7 +57,7 @@ module ActiveRecord
57
57
  # * <tt>:database</tt> - The name of the database. No default, must be provided.
58
58
  # * <tt>:encoding</tt> - (Optional) Sets the client encoding by executing "SET NAMES <encoding>" after connection.
59
59
  # * <tt>:reconnect</tt> - Defaults to false (See MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html).
60
- # * <tt>:strict</tt> - Defaults to true. Enable STRICT_ALL_TABLES. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html)
60
+ # * <tt>:strict</tt> - Defaults to true. Enable STRICT_ALL_TABLES. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/sql-mode.html)
61
61
  # * <tt>:variables</tt> - (Optional) A hash session variables to send as `SET @@SESSION.key = value` on each database connection. Use the value `:default` to set a variable to its DEFAULT value. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/set-statement.html).
62
62
  # * <tt>:sslca</tt> - Necessary to use MySQL with an SSL connection.
63
63
  # * <tt>:sslkey</tt> - Necessary to use MySQL with an SSL connection.
@@ -532,12 +532,10 @@ module ActiveRecord
532
532
  conn.insert_fixture(row, fixture_set_name)
533
533
  end
534
534
  end
535
- end
536
535
 
537
- # Cap primary key sequences to max(pk).
538
- if connection.respond_to?(:reset_pk_sequence!)
539
- fixture_sets.each do |fs|
540
- connection.reset_pk_sequence!(fs.table_name)
536
+ # Cap primary key sequences to max(pk).
537
+ if conn.respond_to?(:reset_pk_sequence!)
538
+ conn.reset_pk_sequence!(fs.table_name)
541
539
  end
542
540
  end
543
541
  end
@@ -692,6 +690,10 @@ module ActiveRecord
692
690
  def lhs_key
693
691
  @association.through_reflection.foreign_key
694
692
  end
693
+
694
+ def join_table
695
+ @association.through_reflection.table_name
696
+ end
695
697
  end
696
698
 
697
699
  private
@@ -7,8 +7,8 @@ module ActiveRecord
7
7
  module VERSION
8
8
  MAJOR = 4
9
9
  MINOR = 1
10
- TINY = 11
11
- PRE = nil
10
+ TINY = 12
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -234,7 +234,7 @@ db_namespace = namespace :db do
234
234
  end
235
235
 
236
236
  desc 'Load a schema.rb file into the database'
237
- task :load => [:load_config] do
237
+ task :load => [:environment, :load_config] do
238
238
  ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA'])
239
239
  end
240
240
 
@@ -146,7 +146,7 @@ module ActiveRecord
146
146
  @scope = scope
147
147
  @options = options
148
148
  @active_record = active_record
149
- @klass = options[:class]
149
+ @klass = options[:anonymous_class]
150
150
  @plural_name = active_record.pluralize_table_names ?
151
151
  name.to_s.pluralize : name.to_s
152
152
  end
@@ -534,7 +534,9 @@ module ActiveRecord
534
534
  # # => <ActiveRecord::Reflection::AssociationReflection: @macro=:belongs_to, @name=:tag, @active_record=Tagging, @plural_name="tags">
535
535
  #
536
536
  def source_reflection
537
- through_reflection.klass._reflect_on_association(source_reflection_name)
537
+ if source_reflection_name
538
+ through_reflection.klass._reflect_on_association(source_reflection_name)
539
+ end
538
540
  end
539
541
 
540
542
  # Returns the AssociationReflection object specified in the <tt>:through</tt> option
@@ -40,7 +40,7 @@ module ActiveRecord
40
40
  BLACKLISTED_ARRAY_METHODS = [
41
41
  :compact!, :flatten!, :reject!, :reverse!, :rotate!, :map!,
42
42
  :shuffle!, :slice!, :sort!, :sort_by!, :delete_if,
43
- :keep_if, :pop, :shift, :delete_at, :compact, :select!
43
+ :keep_if, :pop, :shift, :delete_at, :select!
44
44
  ].to_set # :nodoc:
45
45
 
46
46
  delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to_ary, :join, to: :to_a
@@ -358,7 +358,7 @@ module ActiveRecord
358
358
  def construct_relation_for_association_calculations
359
359
  from = arel.froms.first
360
360
  if Arel::Table === from
361
- apply_join_dependency(self, construct_join_dependency)
361
+ apply_join_dependency(self, construct_join_dependency(joins_values))
362
362
  else
363
363
  # FIXME: as far as I can tell, `from` will always be an Arel::Table.
364
364
  # There are no tests that test this branch, but presumably it's
@@ -61,8 +61,11 @@ module ActiveRecord
61
61
  end
62
62
 
63
63
  column = reflection.foreign_key
64
- primary_key = reflection.association_primary_key(base_class)
65
- value = convert_value_to_association_ids(value, primary_key)
64
+
65
+ if base_class
66
+ primary_key = reflection.association_primary_key(base_class)
67
+ value = convert_value_to_association_ids(value, primary_key)
68
+ end
66
69
  end
67
70
 
68
71
  queries << build(table[column], value)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.11
4
+ version: 4.1.12.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.11
19
+ version: 4.1.12.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.1.11
26
+ version: 4.1.12.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.11
33
+ version: 4.1.12.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.11
40
+ version: 4.1.12.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -243,9 +243,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
243
  version: 1.9.3
244
244
  required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - ">="
246
+ - - ">"
247
247
  - !ruby/object:Gem::Version
248
- version: '0'
248
+ version: 1.3.1
249
249
  requirements: []
250
250
  rubyforge_project:
251
251
  rubygems_version: 2.4.5