activerecord 4.2.0.beta3 → 4.2.0.beta4

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -2
  3. data/lib/active_record/associations.rb +6 -0
  4. data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +1 -1
  5. data/lib/active_record/associations/collection_association.rb +6 -1
  6. data/lib/active_record/associations/collection_proxy.rb +14 -17
  7. data/lib/active_record/associations/has_many_through_association.rb +9 -6
  8. data/lib/active_record/associations/join_dependency.rb +12 -3
  9. data/lib/active_record/associations/join_dependency/join_part.rb +0 -1
  10. data/lib/active_record/associations/singular_association.rb +6 -1
  11. data/lib/active_record/attribute_methods.rb +7 -4
  12. data/lib/active_record/attribute_methods/serialization.rb +8 -7
  13. data/lib/active_record/attribute_set/builder.rb +5 -2
  14. data/lib/active_record/autosave_association.rb +3 -1
  15. data/lib/active_record/callbacks.rb +5 -5
  16. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +8 -6
  17. data/lib/active_record/connection_adapters/abstract/database_statements.rb +2 -1
  18. data/lib/active_record/connection_adapters/abstract/quoting.rb +1 -1
  19. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +11 -18
  20. data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +1 -1
  21. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +1 -1
  22. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +20 -9
  23. data/lib/active_record/connection_adapters/column.rb +20 -0
  24. data/lib/active_record/connection_adapters/connection_specification.rb +8 -3
  25. data/lib/active_record/connection_adapters/mysql2_adapter.rb +0 -5
  26. data/lib/active_record/connection_adapters/mysql_adapter.rb +1 -1
  27. data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +3 -3
  28. data/lib/active_record/connection_adapters/postgresql/oid/range.rb +7 -4
  29. data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +1 -1
  30. data/lib/active_record/connection_adapters/postgresql/quoting.rb +1 -1
  31. data/lib/active_record/connection_adapters/postgresql_adapter.rb +4 -8
  32. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +0 -4
  33. data/lib/active_record/core.rb +14 -9
  34. data/lib/active_record/errors.rb +1 -1
  35. data/lib/active_record/fixtures.rb +3 -35
  36. data/lib/active_record/gem_version.rb +1 -1
  37. data/lib/active_record/inheritance.rb +2 -2
  38. data/lib/active_record/model_schema.rb +8 -11
  39. data/lib/active_record/querying.rb +12 -2
  40. data/lib/active_record/railties/databases.rake +1 -1
  41. data/lib/active_record/reflection.rb +24 -12
  42. data/lib/active_record/relation.rb +2 -3
  43. data/lib/active_record/relation/finder_methods.rb +19 -10
  44. data/lib/active_record/relation/merger.rb +15 -15
  45. data/lib/active_record/relation/predicate_builder.rb +1 -1
  46. data/lib/active_record/relation/predicate_builder/array_handler.rb +9 -4
  47. data/lib/active_record/relation/query_methods.rb +6 -3
  48. data/lib/active_record/result.rb +4 -0
  49. data/lib/active_record/schema_dumper.rb +2 -0
  50. data/lib/active_record/scoping/named.rb +4 -0
  51. data/lib/active_record/tasks/database_tasks.rb +6 -3
  52. data/lib/active_record/transactions.rb +3 -3
  53. data/lib/active_record/type/boolean.rb +12 -1
  54. data/lib/active_record/validations/associated.rb +5 -3
  55. data/lib/active_record/validations/presence.rb +5 -3
  56. metadata +16 -16
@@ -10,8 +10,19 @@ module ActiveRecord
10
10
  def cast_value(value)
11
11
  if value == ''
12
12
  nil
13
+ elsif ConnectionAdapters::Column::TRUE_VALUES.include?(value)
14
+ true
13
15
  else
14
- ConnectionAdapters::Column::TRUE_VALUES.include?(value)
16
+ if !ConnectionAdapters::Column::FALSE_VALUES.include?(value)
17
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
18
+ You attempted to assign a value which is not explicitly `true` or `false`
19
+ to a boolean column. Currently this value casts to `false`. This will
20
+ change to match Ruby's semantics, and will cast to `true` in Rails 5.
21
+ If you would like to maintain the current behavior, you should
22
+ explicitly handle the values you would like cast to `false`.
23
+ MSG
24
+ end
25
+ false
15
26
  end
16
27
  end
17
28
  end
@@ -29,9 +29,11 @@ module ActiveRecord
29
29
  # Configuration options:
30
30
  #
31
31
  # * <tt>:message</tt> - A custom error message (default is: "is invalid").
32
- # * <tt>:on</tt> - Specifies when this validation is active. Runs in all
33
- # validation contexts by default (+nil+), other options are <tt>:create</tt>
34
- # and <tt>:update</tt>.
32
+ # * <tt>:on</tt> - Specifies the contexts where this validation is active.
33
+ # Runs in all validation contexts by default (nil). You can pass a symbol
34
+ # or an array of symbols. (e.g. <tt>on: :create</tt> or
35
+ # <tt>on: :custom_validation_context</tt> or
36
+ # <tt>on: [:create, :custom_validation_context]</tt>)
35
37
  # * <tt>:if</tt> - Specifies a method, proc or string to call to determine
36
38
  # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
37
39
  # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
@@ -44,9 +44,11 @@ module ActiveRecord
44
44
  #
45
45
  # Configuration options:
46
46
  # * <tt>:message</tt> - A custom error message (default is: "can't be blank").
47
- # * <tt>:on</tt> - Specifies when this validation is active. Runs in all
48
- # validation contexts by default (+nil+), other options are <tt>:create</tt>
49
- # and <tt>:update</tt>.
47
+ # * <tt>:on</tt> - Specifies the contexts where this validation is active.
48
+ # Runs in all validation contexts by default (nil). You can pass a symbol
49
+ # or an array of symbols. (e.g. <tt>on: :create</tt> or
50
+ # <tt>on: :custom_validation_context</tt> or
51
+ # <tt>on: [:create, :custom_validation_context]</tt>)
50
52
  # * <tt>:if</tt> - Specifies a method, proc or string to call to determine if
51
53
  # the validation should occur (e.g. <tt>if: :allow_validation</tt>, or
52
54
  # <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, proc
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.2.0.beta3
4
+ version: 4.2.0.beta4
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: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,46 +16,46 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0.beta3
19
+ version: 4.2.0.beta4
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.2.0.beta3
26
+ version: 4.2.0.beta4
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.2.0.beta3
33
+ version: 4.2.0.beta4
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.2.0.beta3
40
+ version: 4.2.0.beta4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 6.0.0.beta1
48
- - - "<"
47
+ version: 6.0.0.beta2
48
+ - - <
49
49
  - !ruby/object:Gem::Version
50
50
  version: '6.1'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ">="
55
+ - - '>='
56
56
  - !ruby/object:Gem::Version
57
- version: 6.0.0.beta1
58
- - - "<"
57
+ version: 6.0.0.beta2
58
+ - - <
59
59
  - !ruby/object:Gem::Version
60
60
  version: '6.1'
61
61
  description: Databases on Rails. Build a persistent domain model by mapping database
@@ -290,23 +290,23 @@ licenses:
290
290
  metadata: {}
291
291
  post_install_message:
292
292
  rdoc_options:
293
- - "--main"
293
+ - --main
294
294
  - README.rdoc
295
295
  require_paths:
296
296
  - lib
297
297
  required_ruby_version: !ruby/object:Gem::Requirement
298
298
  requirements:
299
- - - ">="
299
+ - - '>='
300
300
  - !ruby/object:Gem::Version
301
301
  version: 1.9.3
302
302
  required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  requirements:
304
- - - ">"
304
+ - - '>'
305
305
  - !ruby/object:Gem::Version
306
306
  version: 1.3.1
307
307
  requirements: []
308
308
  rubyforge_project:
309
- rubygems_version: 2.2.2
309
+ rubygems_version: 2.2.1
310
310
  signing_key:
311
311
  specification_version: 4
312
312
  summary: Object-relational mapper framework (part of Rails).