activerecord 3.2.14 → 3.2.15.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.

@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: efc1f2e4ba428c380ccf054e10fa2d01ee910e4b
4
+ data.tar.gz: c68c678373ef01b598f45f4db528daa202c6120f
5
+ SHA512:
6
+ metadata.gz: 4fdd8c37a499b95515e6c6eaad639056b1074933ebf469b004eb57dfcfd4d148c318c3125c340c23371afc15a501c0c2ed5c59306e297c4c57c8a25ba37b34df
7
+ data.tar.gz: d5114f727c0ce055f3fec3ebef55a89b5697b3aa38527290cdb430826cdb2d9e0caf81d68656cf11c45a63b1790d90b5044be2e21ca487aa81ee61f19afb052e
@@ -1,5 +1,46 @@
1
+ ## unreleased ##
2
+ * Move .set_inverse_instance call to association.build_record method. Everytime a new record is build
3
+ using the association, we need to try to set the inverse_of relation.
4
+
5
+ Fixes #10371.
6
+
7
+ *arthurnn*
8
+
9
+ * When calling the method .find_or_initialize_by_* from a collection_proxy
10
+ it should set the inverse_of relation even when the entry was found on the db.
11
+
12
+ *arthurnn*
13
+
14
+ * Callbacks on has_many should access the in memory parent if a inverse_of is set.
15
+
16
+ *arthurnn*
17
+
18
+ * Fix `FinderMethods#last` unscoped primary key.
19
+
20
+ Fixes #11917.
21
+
22
+ *Eugene Kalenkovich*
23
+
24
+ * Load fixtures from linked folders.
25
+
26
+ *Kassio Borges*
27
+
28
+ * When using optimistic locking, `update` was not passing the column to `quote_value`
29
+ to allow the connection adapter to properly determine how to quote the value. This was
30
+ affecting certain databases that use specific colmn types.
31
+
32
+ Fixes: #6763
33
+
34
+ *Alfred Wong*
35
+
36
+
1
37
  ## Rails 3.2.14 (Jul 22, 2013) ##
2
38
 
39
+ * Fix merge error when Equality LHS is non-attribute.
40
+ Backport of #7380.
41
+
42
+ *Karmes Alexander*
43
+
3
44
  * Do not re-create destroyed association when saving the parent object.
4
45
 
5
46
  Fixes #11450.
@@ -240,6 +240,7 @@ module ActiveRecord
240
240
  skip_assign = [reflection.foreign_key, reflection.type].compact
241
241
  attributes = create_scope.except(*(record.changed - skip_assign))
242
242
  record.assign_attributes(attributes, :without_protection => true)
243
+ set_inverse_instance(record)
243
244
  end
244
245
  end
245
246
  end
@@ -350,7 +350,6 @@ module ActiveRecord
350
350
  end
351
351
 
352
352
  callback(:after_add, record)
353
- set_inverse_instance(record)
354
353
 
355
354
  record
356
355
  end
@@ -77,10 +77,12 @@ module ActiveRecord
77
77
  def method_missing(method, *args, &block)
78
78
  match = DynamicFinderMatch.match(method)
79
79
  if match && match.instantiator?
80
- send(:find_or_instantiator_by_attributes, match, match.attribute_names, *args) do |r|
81
- proxy_association.send :set_owner_attributes, r
82
- proxy_association.send :add_to_target, r
83
- yield(r) if block_given?
80
+ send(:find_or_instantiator_by_attributes, match, match.attribute_names, *args) do |record|
81
+ proxy_association.send :set_owner_attributes, record
82
+ proxy_association.send :add_to_target, record
83
+ yield(record) if block_given?
84
+ end.tap do |record|
85
+ proxy_association.send :set_inverse_instance, record
84
86
  end
85
87
 
86
88
  elsif target.respond_to?(method) || (!proxy_association.klass.respond_to?(method) && Class.respond_to?(method))
@@ -9,6 +9,7 @@ module ActiveRecord
9
9
 
10
10
  def insert_record(record, validate = true, raise = false)
11
11
  set_owner_attributes(record)
12
+ set_inverse_instance(record)
12
13
 
13
14
  if raise
14
15
  record.save!(:validate => validate)
@@ -9,7 +9,7 @@ module ActiveRecord
9
9
  @tables = {}
10
10
 
11
11
  @columns = Hash.new do |h, table_name|
12
- h[table_name] = conn.columns(table_name, "#{table_name} Columns")
12
+ h[table_name] = connection.columns(table_name, "#{table_name} Columns")
13
13
  end
14
14
 
15
15
  @columns_hash = Hash.new do |h, table_name|
@@ -19,7 +19,7 @@ module ActiveRecord
19
19
  end
20
20
 
21
21
  @primary_keys = Hash.new do |h, table_name|
22
- h[table_name] = table_exists?(table_name) ? conn.primary_key(table_name) : nil
22
+ h[table_name] = table_exists?(table_name) ? connection.primary_key(table_name) : nil
23
23
  end
24
24
  end
25
25
 
@@ -661,7 +661,7 @@ module ActiveRecord
661
661
  end
662
662
 
663
663
  def read_fixture_files
664
- yaml_files = Dir["#{@fixture_path}/**/*.yml"].select { |f|
664
+ yaml_files = Dir["#{@fixture_path}/{**,*}/*.yml"].select { |f|
665
665
  ::File.file?(f)
666
666
  } + [yaml_file_path]
667
667
 
@@ -752,7 +752,7 @@ module ActiveRecord
752
752
 
753
753
  def fixtures(*fixture_names)
754
754
  if fixture_names.first == :all
755
- fixture_names = Dir["#{fixture_path}/**/*.{yml}"]
755
+ fixture_names = Dir["#{fixture_path}/{**,*}/*.{yml}"]
756
756
  fixture_names.map! { |f| f[(fixture_path.size + 1)..-5] }
757
757
  else
758
758
  fixture_names = fixture_names.flatten.map { |n| n.to_s }
@@ -80,7 +80,7 @@ module ActiveRecord
80
80
 
81
81
  stmt = relation.where(
82
82
  relation.table[self.class.primary_key].eq(id).and(
83
- relation.table[lock_col].eq(quote_value(previous_lock_value))
83
+ relation.table[lock_col].eq(quote_value(previous_lock_value, self.class.columns_hash[lock_col]))
84
84
  )
85
85
  ).arel.compile_update(arel_attributes_values(false, false, attribute_names))
86
86
 
@@ -134,8 +134,8 @@ module ActiveRecord
134
134
  def last(*args)
135
135
  if args.any?
136
136
  if args.first.kind_of?(Integer) || (loaded? && !args.first.kind_of?(Hash))
137
- if order_values.empty?
138
- order("#{primary_key} DESC").limit(*args).reverse
137
+ if order_values.empty? && primary_key
138
+ order("#{quoted_table_name}.#{quoted_primary_key} DESC").limit(*args).reverse
139
139
  else
140
140
  to_a.last(*args)
141
141
  end
@@ -32,11 +32,12 @@ module ActiveRecord
32
32
  merged_wheres = @where_values + r.where_values
33
33
 
34
34
  unless @where_values.empty?
35
- # Remove duplicates, last one wins.
35
+ # Remove duplicate ARel attributes. Last one wins.
36
36
  seen = Hash.new { |h,table| h[table] = {} }
37
37
  merged_wheres = merged_wheres.reverse.reject { |w|
38
38
  nuke = false
39
- if w.respond_to?(:operator) && w.operator == :==
39
+ if w.respond_to?(:operator) && w.operator == :== &&
40
+ w.left.respond_to?(:relation)
40
41
  name = w.left.name
41
42
  table = w.left.relation.name
42
43
  nuke = seen[table][name]
@@ -150,7 +151,7 @@ module ActiveRecord
150
151
  values = other.joins_values
151
152
  return if values.blank?
152
153
 
153
- if other.klass == relation.klass
154
+ if other.klass >= relation.klass
154
155
  relation.joins_values += values
155
156
  else
156
157
  joins_dependency, rest = values.partition do |join|
@@ -2,8 +2,8 @@ module ActiveRecord
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 14
6
- PRE = nil
5
+ TINY = 15
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,96 +1,80 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 3
8
- - 2
9
- - 14
10
- version: 3.2.14
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.2.15.rc1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - David Heinemeier Hansson
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-07-22 00:00:00 -03:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - "="
26
- - !ruby/object:Gem::Version
27
- hash: 19
28
- segments:
29
- - 3
30
- - 2
31
- - 14
32
- version: 3.2.14
33
- type: :runtime
11
+ date: 2013-10-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
34
14
  name: activesupport
35
- version_requirements: *id001
36
- prerelease: false
37
- - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - "="
42
- - !ruby/object:Gem::Version
43
- hash: 19
44
- segments:
45
- - 3
46
- - 2
47
- - 14
48
- version: 3.2.14
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.15.rc1
49
20
  type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.15.rc1
27
+ - !ruby/object:Gem::Dependency
50
28
  name: activemodel
51
- version_requirements: *id002
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 3.2.15.rc1
34
+ type: :runtime
52
35
  prerelease: false
53
- - !ruby/object:Gem::Dependency
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 3
62
- - 0
63
- - 2
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.15.rc1
41
+ - !ruby/object:Gem::Dependency
42
+ name: arel
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
64
47
  version: 3.0.2
65
48
  type: :runtime
66
- name: arel
67
- version_requirements: *id003
68
49
  prerelease: false
69
- - !ruby/object:Gem::Dependency
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ~>
74
- - !ruby/object:Gem::Version
75
- hash: 41
76
- segments:
77
- - 0
78
- - 3
79
- - 29
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: tzinfo
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
80
61
  version: 0.3.29
81
62
  type: :runtime
82
- name: tzinfo
83
- version_requirements: *id004
84
63
  prerelease: false
85
- description: Databases on Rails. Build a persistent domain model by mapping database tables to Ruby classes. Strong conventions for associations, validations, aggregations, migrations, and testing come baked-in.
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.3.29
69
+ description: Databases on Rails. Build a persistent domain model by mapping database
70
+ tables to Ruby classes. Strong conventions for associations, validations, aggregations,
71
+ migrations, and testing come baked-in.
86
72
  email: david@loudthinking.com
87
73
  executables: []
88
-
89
74
  extensions: []
90
-
91
- extra_rdoc_files:
75
+ extra_rdoc_files:
92
76
  - README.rdoc
93
- files:
77
+ files:
94
78
  - CHANGELOG.md
95
79
  - MIT-LICENSE
96
80
  - README.rdoc
@@ -240,42 +224,30 @@ files:
240
224
  - lib/rails/generators/active_record/session_migration/session_migration_generator.rb
241
225
  - lib/rails/generators/active_record/session_migration/templates/migration.rb
242
226
  - lib/rails/generators/active_record.rb
243
- has_rdoc: true
244
227
  homepage: http://www.rubyonrails.org
245
- licenses:
228
+ licenses:
246
229
  - MIT
230
+ metadata: {}
247
231
  post_install_message:
248
- rdoc_options:
249
- - --main
232
+ rdoc_options:
233
+ - "--main"
250
234
  - README.rdoc
251
- require_paths:
235
+ require_paths:
252
236
  - lib
253
- required_ruby_version: !ruby/object:Gem::Requirement
254
- none: false
255
- requirements:
237
+ required_ruby_version: !ruby/object:Gem::Requirement
238
+ requirements:
256
239
  - - ">="
257
- - !ruby/object:Gem::Version
258
- hash: 57
259
- segments:
260
- - 1
261
- - 8
262
- - 7
240
+ - !ruby/object:Gem::Version
263
241
  version: 1.8.7
264
- required_rubygems_version: !ruby/object:Gem::Requirement
265
- none: false
266
- requirements:
267
- - - ">="
268
- - !ruby/object:Gem::Version
269
- hash: 3
270
- segments:
271
- - 0
272
- version: "0"
242
+ required_rubygems_version: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - ">"
245
+ - !ruby/object:Gem::Version
246
+ version: 1.3.1
273
247
  requirements: []
274
-
275
248
  rubyforge_project:
276
- rubygems_version: 1.6.2
249
+ rubygems_version: 2.0.2
277
250
  signing_key:
278
- specification_version: 3
251
+ specification_version: 4
279
252
  summary: Object-relational mapper framework (part of Rails).
280
253
  test_files: []
281
-