default_value_for 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +4 -2
- data/default_value_for.gemspec +3 -3
- data/lib/default_value_for.rb +3 -3
- metadata +24 -23
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTU2M2Y3MTM4OGYwOTMzZTUwNWM1NmVlMmYxNzRlMTAwOTY5MWJhMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5510f9a27e91ae223795763c6c31032098fac9bd
|
4
|
+
data.tar.gz: b0c331e41f03e7a6344c968a099b1fcb3e99085e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YTIzYTZlMzNkNWFjZmJmMjA3ZWI3ODg0MGY2NWRiNzNkMGM2NGUxOTU5ODU0
|
11
|
-
MjVjYzAzZjQ0MWViYWM5OTA3MWZmOTU4YjdhMTZlNDZkMzA1ZGM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZjQwNDIwOTJmNTFhMmQ2YjljYTdjMmZkNjk0MjAzY2JhZTI0MDkxY2JiM2Q3
|
14
|
-
Y2ExOTA2MjM4ZWE4YjQ4NzMzZWM5OGU1ZGVjYjJmMjMwZDkxY2Q2ODFkNTFj
|
15
|
-
NzcyNDAxMWI0ZTE1M2NkNjEwYmI5OWRiY2FmODhiZWI1Y2M4MTQ=
|
6
|
+
metadata.gz: 17432a0c7d31207478c48982a88788a899e458963812504255f05e3ab2d82ffa9c3ed2d7291963ecd16ea7dd969473ff0f5a70f66ae4cbbb96b2f2ba9c692f09
|
7
|
+
data.tar.gz: ce0687773f91cf657cfbed4edc97bcedb6a4565a12e99f770300ff2e4c15544f7e1404d47921053f3f07ed424225c95904205ab5ceaa55c41f877117255916be
|
data/README.md
CHANGED
@@ -364,7 +364,7 @@ Also, stick with the following rules:
|
|
364
364
|
|
365
365
|
* There is no need to +alias_method_chain+ your initialize method in models that don't use `default_value_for`.
|
366
366
|
|
367
|
-
* Make sure that +alias_method_chain+ is called *after* the last `default_value_for`
|
367
|
+
* Make sure that +alias_method_chain+ is called *after* the last `default_value_for` occurrence.
|
368
368
|
|
369
369
|
If your default value is accidentally similar to default_value_for's options hash wrap your default value like this:
|
370
370
|
|
@@ -553,4 +553,6 @@ I've wanted such functionality for a while now and it baffled me that ActiveReco
|
|
553
553
|
|
554
554
|
Thanks to Pratik Naik for providing the initial code snippet on which this plugin is based on: http://m.onkey.org/2007/7/24/how-to-set-default-values-in-your-model
|
555
555
|
|
556
|
-
Thanks to
|
556
|
+
Thanks to Matthew Draper for Rails 5 support.
|
557
|
+
|
558
|
+
Thanks to Norman Clarke and Tom Mango for Rails 4 support.
|
data/default_value_for.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{default_value_for}
|
3
|
-
s.version = "3.0.
|
3
|
+
s.version = "3.0.2"
|
4
4
|
s.summary = %q{Provides a way to specify default values for ActiveRecord models}
|
5
5
|
s.description = %q{The default_value_for plugin allows one to define default values for ActiveRecord models in a declarative manner}
|
6
6
|
s.email = %q{software-signing@phusion.nl}
|
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
'lib/default_value_for.rb',
|
15
15
|
'lib/default_value_for/railtie.rb'
|
16
16
|
]
|
17
|
-
s.add_dependency 'activerecord', '>= 3.2.0', '< 5.
|
18
|
-
s.add_development_dependency 'railties', '>= 3.2.0', '< 5.
|
17
|
+
s.add_dependency 'activerecord', '>= 3.2.0', '< 5.1'
|
18
|
+
s.add_development_dependency 'railties', '>= 3.2.0', '< 5.1'
|
19
19
|
s.add_development_dependency 'minitest', '>= 4.2'
|
20
20
|
s.add_development_dependency 'minitest-around'
|
21
21
|
s.add_development_dependency 'appraisal'
|
data/lib/default_value_for.rb
CHANGED
@@ -116,7 +116,7 @@ module DefaultValueFor
|
|
116
116
|
|
117
117
|
def _all_default_attribute_values_not_allowing_nil
|
118
118
|
return _default_attribute_values_not_allowing_nil unless superclass.respond_to?(:_default_attribute_values_not_allowing_nil)
|
119
|
-
result = superclass._all_default_attribute_values_not_allowing_nil
|
119
|
+
result = superclass._all_default_attribute_values_not_allowing_nil + _default_attribute_values_not_allowing_nil
|
120
120
|
result.uniq!
|
121
121
|
result
|
122
122
|
end
|
@@ -176,8 +176,8 @@ module DefaultValueFor
|
|
176
176
|
!self.class._all_default_attribute_values_not_allowing_nil.include?(attribute)
|
177
177
|
|
178
178
|
__send__("#{attribute}=", container.evaluate(self))
|
179
|
-
if
|
180
|
-
clear_attribute_changes attribute
|
179
|
+
if respond_to?(:clear_attribute_changes, true)
|
180
|
+
clear_attribute_changes [attribute] if has_attribute?(attribute)
|
181
181
|
else
|
182
182
|
changed_attributes.delete(attribute)
|
183
183
|
end
|
metadata
CHANGED
@@ -1,95 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: default_value_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hongli Lai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.2.0
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.2.0
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: railties
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 3.2.0
|
40
|
-
- - <
|
40
|
+
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '5.
|
42
|
+
version: '5.1'
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 3.2.0
|
50
|
-
- - <
|
50
|
+
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '5.
|
52
|
+
version: '5.1'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: minitest
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '4.2'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- -
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '4.2'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: minitest-around
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: appraisal
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
description: The default_value_for plugin allows one to define default values for
|
@@ -117,18 +117,19 @@ require_paths:
|
|
117
117
|
- lib
|
118
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: 1.9.3
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.4.5.1
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Provides a way to specify default values for ActiveRecord models
|
134
134
|
test_files: []
|
135
|
+
has_rdoc:
|