activerecord 5.0.0.1 → 5.0.1.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.

Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +196 -2
  3. data/README.rdoc +1 -1
  4. data/lib/active_record.rb +1 -1
  5. data/lib/active_record/aggregations.rb +4 -2
  6. data/lib/active_record/association_relation.rb +4 -1
  7. data/lib/active_record/associations.rb +5 -0
  8. data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +4 -2
  9. data/lib/active_record/associations/builder/singular_association.rb +10 -1
  10. data/lib/active_record/associations/collection_association.rb +22 -17
  11. data/lib/active_record/associations/collection_proxy.rb +20 -7
  12. data/lib/active_record/associations/has_many_through_association.rb +4 -0
  13. data/lib/active_record/associations/join_dependency.rb +10 -4
  14. data/lib/active_record/associations/join_dependency/join_part.rb +2 -2
  15. data/lib/active_record/associations/preloader/association.rb +18 -4
  16. data/lib/active_record/associations/preloader/collection_association.rb +0 -1
  17. data/lib/active_record/associations/preloader/singular_association.rb +0 -1
  18. data/lib/active_record/associations/singular_association.rb +8 -2
  19. data/lib/active_record/attribute.rb +3 -3
  20. data/lib/active_record/attribute_methods.rb +3 -7
  21. data/lib/active_record/attribute_methods/primary_key.rb +14 -1
  22. data/lib/active_record/attribute_methods/time_zone_conversion.rb +1 -1
  23. data/lib/active_record/attribute_set.rb +2 -0
  24. data/lib/active_record/attribute_set/builder.rb +29 -7
  25. data/lib/active_record/attributes.rb +3 -3
  26. data/lib/active_record/autosave_association.rb +15 -11
  27. data/lib/active_record/base.rb +1 -1
  28. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +40 -32
  29. data/lib/active_record/connection_adapters/abstract/database_statements.rb +1 -1
  30. data/lib/active_record/connection_adapters/abstract/query_cache.rb +29 -0
  31. data/lib/active_record/connection_adapters/abstract/quoting.rb +4 -4
  32. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +8 -7
  33. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +37 -33
  34. data/lib/active_record/connection_adapters/abstract_adapter.rb +28 -5
  35. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +42 -45
  36. data/lib/active_record/connection_adapters/mysql/column.rb +1 -1
  37. data/lib/active_record/connection_adapters/mysql/database_statements.rb +6 -23
  38. data/lib/active_record/connection_adapters/mysql/quoting.rb +1 -1
  39. data/lib/active_record/connection_adapters/mysql2_adapter.rb +1 -5
  40. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +8 -0
  41. data/lib/active_record/connection_adapters/postgresql/oid/array.rb +12 -1
  42. data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +2 -2
  43. data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +2 -0
  44. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +7 -1
  45. data/lib/active_record/connection_adapters/postgresql_adapter.rb +6 -2
  46. data/lib/active_record/core.rb +3 -1
  47. data/lib/active_record/enum.rb +6 -5
  48. data/lib/active_record/gem_version.rb +2 -2
  49. data/lib/active_record/integration.rb +13 -10
  50. data/lib/active_record/migration.rb +6 -5
  51. data/lib/active_record/model_schema.rb +134 -47
  52. data/lib/active_record/no_touching.rb +4 -0
  53. data/lib/active_record/persistence.rb +10 -4
  54. data/lib/active_record/query_cache.rb +13 -15
  55. data/lib/active_record/querying.rb +3 -3
  56. data/lib/active_record/railties/controller_runtime.rb +1 -1
  57. data/lib/active_record/reflection.rb +8 -0
  58. data/lib/active_record/relation.rb +7 -4
  59. data/lib/active_record/relation/calculations.rb +11 -11
  60. data/lib/active_record/relation/delegation.rb +1 -1
  61. data/lib/active_record/relation/finder_methods.rb +11 -9
  62. data/lib/active_record/relation/query_methods.rb +3 -3
  63. data/lib/active_record/result.rb +7 -1
  64. data/lib/active_record/sanitization.rb +11 -1
  65. data/lib/active_record/schema_dumper.rb +10 -17
  66. data/lib/active_record/scoping/named.rb +1 -1
  67. data/lib/active_record/statement_cache.rb +2 -2
  68. data/lib/active_record/table_metadata.rb +4 -3
  69. data/lib/active_record/touch_later.rb +6 -1
  70. data/lib/active_record/type/internal/abstract_json.rb +5 -1
  71. data/lib/active_record/validations/uniqueness.rb +3 -4
  72. metadata +9 -10
@@ -8,7 +8,12 @@ module ActiveRecord
8
8
  end
9
9
 
10
10
  def touch_later(*names) # :nodoc:
11
- raise ActiveRecordError, "cannot touch on a new record object" unless persisted?
11
+ unless persisted?
12
+ raise ActiveRecordError, <<-MSG.squish
13
+ cannot touch on a new or destroyed record object. Consider using
14
+ persisted?, new_record?, or destroyed? before touching
15
+ MSG
16
+ end
12
17
 
13
18
  @_defer_touch_attrs ||= timestamp_attributes_for_update_in_model
14
19
  @_defer_touch_attrs |= names
@@ -17,7 +17,11 @@ module ActiveRecord
17
17
  end
18
18
 
19
19
  def serialize(value)
20
- ::ActiveSupport::JSON.encode(value)
20
+ if value.nil?
21
+ nil
22
+ else
23
+ ::ActiveSupport::JSON.encode(value)
24
+ end
21
25
  end
22
26
 
23
27
  def accessor
@@ -86,11 +86,10 @@ module ActiveRecord
86
86
 
87
87
  def scope_relation(record, table, relation)
88
88
  Array(options[:scope]).each do |scope_item|
89
- if reflection = record.class._reflect_on_association(scope_item)
90
- scope_value = record.send(reflection.foreign_key)
91
- scope_item = reflection.foreign_key
89
+ scope_value = if record.class._reflect_on_association(scope_item)
90
+ record.association(scope_item).reader
92
91
  else
93
- scope_value = record._read_attribute(scope_item)
92
+ record._read_attribute(scope_item)
94
93
  end
95
94
  relation = relation.where(scope_item => scope_value)
96
95
  end
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: 5.0.0.1
4
+ version: 5.0.1.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: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-11-30 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: 5.0.0.1
19
+ version: 5.0.1.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: 5.0.0.1
26
+ version: 5.0.1.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: 5.0.0.1
33
+ version: 5.0.1.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: 5.0.0.1
40
+ version: 5.0.1.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -323,14 +323,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
323
323
  version: 2.2.2
324
324
  required_rubygems_version: !ruby/object:Gem::Requirement
325
325
  requirements:
326
- - - ">="
326
+ - - ">"
327
327
  - !ruby/object:Gem::Version
328
- version: '0'
328
+ version: 1.3.1
329
329
  requirements: []
330
330
  rubyforge_project:
331
- rubygems_version: 2.6.6
331
+ rubygems_version: 2.5.2
332
332
  signing_key:
333
333
  specification_version: 4
334
334
  summary: Object-relational mapper framework (part of Rails).
335
335
  test_files: []
336
- has_rdoc: