activemodel 5.1.0.beta1 → 5.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2722a2216da7e44da498eddfe9cd283628ff4876
4
- data.tar.gz: f7d850f4021cf5f4fd5e4209f9359d645bf1d69f
3
+ metadata.gz: c49039ac3278df2457a9a5b854001bd2801ba3ca
4
+ data.tar.gz: 04527bdc4133fa4d524047ade1afef8ab68c83fc
5
5
  SHA512:
6
- metadata.gz: 6ce16354bc976631475e670f614393ab7859e2cbd32e1348f6d5c58b714ae336af91312b4fcbc3b90346e616c96ab1e03caf8ada1d48a1760aaa49350751c8eb
7
- data.tar.gz: b1a4b60136a4a1df7147359ba25f4fb15d366234e65cfb6f965cc8007d7d72289c02a3a9798249ae9216378d74022af18db6ad948469b95e9dacd8952638b3f1
6
+ metadata.gz: 1c07749aa74321242d26822f59f0019b8a7c3a5b5f328b1a4764ac2f983f91cb908ef4f3762af5cf45d98a0bf13e91949272ac15567075d88bc3b7270b850902
7
+ data.tar.gz: 2f2cf9cab4be69f903d35131a956db57bd49ca6d020a56a43118aacf87c7a758ca907a22782844e37a1edb60453e233d2f241292e01b3f251ff8644d5fd41f12
@@ -1,3 +1,8 @@
1
+ ## Rails 5.1.0.rc1 (March 20, 2017) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 5.1.0.beta1 (February 23, 2017) ##
2
7
 
3
8
  * Remove deprecated behavior that halts callbacks when the return is false.
@@ -8,7 +8,7 @@ module ActiveModel
8
8
  MAJOR = 5
9
9
  MINOR = 1
10
10
  TINY = 0
11
- PRE = "beta1"
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -21,16 +21,8 @@ module ActiveModel
21
21
 
22
22
  class << self
23
23
  attr_accessor :registry # :nodoc:
24
- delegate :add_modifier, to: :registry
25
24
 
26
- # Add a new type to the registry, allowing it to be referenced as a
27
- # symbol by ActiveRecord::Attributes::ClassMethods#attribute. If your
28
- # type is only meant to be used with a specific database adapter, you can
29
- # do so by passing +adapter: :postgresql+. If your type has the same
30
- # name as a native type for the current adapter, an exception will be
31
- # raised unless you specify an +:override+ option. +override: true+ will
32
- # cause your type to be used instead of the native type. +override:
33
- # false+ will cause the native type to be used over yours if one exists.
25
+ # Add a new type to the registry, allowing it to be get through ActiveModel::Type#lookup
34
26
  def register(type_name, klass = nil, **options, &block)
35
27
  registry.register(type_name, klass, **options, &block)
36
28
  end
@@ -12,7 +12,7 @@ module ActiveModel
12
12
  end
13
13
 
14
14
  def type_cast_for_schema(value)
15
- "'#{value.to_s(:db)}'"
15
+ value.to_s(:db).inspect
16
16
  end
17
17
 
18
18
  private
@@ -21,8 +21,14 @@ module ActiveModel
21
21
  case value
22
22
  when ::Float
23
23
  convert_float_to_big_decimal(value)
24
- when ::Numeric, ::String
24
+ when ::Numeric
25
25
  BigDecimal(value, precision || BIGDECIMAL_PRECISION)
26
+ when ::String
27
+ begin
28
+ value.to_d
29
+ rescue ArgumentError
30
+ BigDecimal(0)
31
+ end
26
32
  else
27
33
  if value.respond_to?(:to_d)
28
34
  value.to_d
@@ -38,7 +38,7 @@ module ActiveModel
38
38
  end
39
39
 
40
40
  def type_cast_for_schema(value)
41
- "'#{value.to_s(:db)}'"
41
+ value.to_s(:db).inspect
42
42
  end
43
43
 
44
44
  def user_input_in_time_zone(value)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0.beta1
4
+ version: 5.1.0.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: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.0.beta1
19
+ version: 5.1.0.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.1.0.beta1
26
+ version: 5.1.0.rc1
27
27
  description: A toolkit for building modeling frameworks like Active Record. Rich support
28
28
  for attributes, callbacks, validations, serialization, internationalization, and
29
29
  testing.