activemodel 4.2.0.rc1 → 4.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activemodel might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/active_model/attribute_methods.rb +4 -6
- data/lib/active_model/gem_version.rb +1 -1
- data/lib/active_model/validations/numericality.rb +11 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 730f64c39007b7ccd83f0a170179606e187a83f4
|
4
|
+
data.tar.gz: 84c9b855006ecb33711a8615d2db862574ad220f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e764a287ef04bacdea7a34fbe405e43b072ed373611b1d4d36584077c2cb3b76031d7ce8d9eef55e30f2e1225d5a08ea4b6db52a1cb36d572712716c5a3acb1
|
7
|
+
data.tar.gz: 31ae1b2f2ccd0750467e9daf39ff4d35237a66b67ebe5a9d343fb31b953a997e90bccd51956943374f9e9b6f39b3c5c583c6acccbe43e126b4a4320e74fe645b
|
data/README.rdoc
CHANGED
@@ -246,7 +246,7 @@ The latest version of Active Model can be installed with RubyGems:
|
|
246
246
|
|
247
247
|
Source code can be downloaded as part of the Rails project on GitHub
|
248
248
|
|
249
|
-
* https://github.com/rails/rails/tree/
|
249
|
+
* https://github.com/rails/rails/tree/4-2-stable/activemodel
|
250
250
|
|
251
251
|
|
252
252
|
== License
|
@@ -353,14 +353,12 @@ module ActiveModel
|
|
353
353
|
@attribute_method_matchers_cache ||= ThreadSafe::Cache.new(initial_capacity: 4)
|
354
354
|
end
|
355
355
|
|
356
|
-
def
|
356
|
+
def attribute_method_matchers_matching(method_name) #:nodoc:
|
357
357
|
attribute_method_matchers_cache.compute_if_absent(method_name) do
|
358
358
|
# Must try to match prefixes/suffixes first, or else the matcher with no prefix/suffix
|
359
359
|
# will match every time.
|
360
360
|
matchers = attribute_method_matchers.partition(&:plain?).reverse.flatten(1)
|
361
|
-
match
|
362
|
-
matchers.detect { |method| match = method.match(method_name) }
|
363
|
-
match
|
361
|
+
matchers.map { |method| method.match(method_name) }.compact
|
364
362
|
end
|
365
363
|
end
|
366
364
|
|
@@ -469,8 +467,8 @@ module ActiveModel
|
|
469
467
|
# Returns a struct representing the matching attribute method.
|
470
468
|
# The struct's attributes are prefix, base and suffix.
|
471
469
|
def match_attribute_method?(method_name)
|
472
|
-
|
473
|
-
|
470
|
+
matches = self.class.send(:attribute_method_matchers_matching, method_name)
|
471
|
+
matches.detect { |match| attribute_method?(match.attr_name) }
|
474
472
|
end
|
475
473
|
|
476
474
|
def missing_attribute(attr_name, stack)
|
@@ -23,6 +23,10 @@ module ActiveModel
|
|
23
23
|
raw_value = record.send(before_type_cast) if record.respond_to?(before_type_cast)
|
24
24
|
raw_value ||= value
|
25
25
|
|
26
|
+
if record_attribute_changed_in_place?(record, attr_name)
|
27
|
+
raw_value = value
|
28
|
+
end
|
29
|
+
|
26
30
|
return if options[:allow_nil] && raw_value.nil?
|
27
31
|
|
28
32
|
unless value = parse_raw_value_as_a_number(raw_value)
|
@@ -86,6 +90,13 @@ module ActiveModel
|
|
86
90
|
options[:only_integer]
|
87
91
|
end
|
88
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def record_attribute_changed_in_place?(record, attr_name)
|
97
|
+
record.respond_to?(:attribute_changed_in_place?) &&
|
98
|
+
record.attribute_changed_in_place?(attr_name.to_s)
|
99
|
+
end
|
89
100
|
end
|
90
101
|
|
91
102
|
module HelperMethods
|
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: 4.2.0.
|
4
|
+
version: 4.2.0.rc2
|
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-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,26 +16,26 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.0.
|
19
|
+
version: 4.2.0.rc2
|
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.
|
26
|
+
version: 4.2.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.1'
|
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
40
|
version: '3.1'
|
41
41
|
description: A toolkit for building modeling frameworks like Active Record. Rich support
|
@@ -94,17 +94,17 @@ require_paths:
|
|
94
94
|
- lib
|
95
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - '>='
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: 1.9.3
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - '>'
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 1.3.1
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.2.
|
107
|
+
rubygems_version: 2.2.1
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: A toolkit for building modeling frameworks (part of Rails).
|