File tree 4 files changed +4
-62
lines changed
4 files changed +4
-62
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,11 @@ def collectionize
71
71
# "_id".mongoid_id?
72
72
#
73
73
# @return [ true | false ] If the string is id or _id.
74
+ # @deprecated
74
75
def mongoid_id?
75
76
self =~ /\A (|_)id\z /
76
77
end
78
+ Mongoid . deprecate ( self , :mongoid_id? )
77
79
78
80
# Is the string a number? The literals "NaN", "Infinity", and "-Infinity"
79
81
# are counted as numbers.
Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ module Symbol
13
13
# :_id.mongoid_id?
14
14
#
15
15
# @return [ true | false ] If the symbol is :id or :_id.
16
+ # @deprecated
16
17
def mongoid_id?
17
18
to_s . mongoid_id?
18
19
end
20
+ Mongoid . deprecate ( self , :mongoid_id? )
19
21
20
22
module ClassMethods
21
23
Original file line number Diff line number Diff line change @@ -172,37 +172,6 @@ class Patient
172
172
end
173
173
end
174
174
175
- describe "#mongoid_id?" do
176
-
177
- context "when the string is id" do
178
-
179
- it "returns true" do
180
- expect ( "id" ) . to be_mongoid_id
181
- end
182
- end
183
-
184
- context "when the string is _id" do
185
-
186
- it "returns true" do
187
- expect ( "_id" ) . to be_mongoid_id
188
- end
189
- end
190
-
191
- context "when the string contains id" do
192
-
193
- it "returns false" do
194
- expect ( "identity" ) . to_not be_mongoid_id
195
- end
196
- end
197
-
198
- context "when the string contains _id" do
199
-
200
- it "returns false" do
201
- expect ( "something_id" ) . to_not be_mongoid_id
202
- end
203
- end
204
- end
205
-
206
175
[ :mongoize , :demongoize ] . each do |method |
207
176
208
177
describe ".#{ method } " do
Original file line number Diff line number Diff line change 5
5
6
6
describe Mongoid ::Extensions ::Symbol do
7
7
8
- describe "#mongoid_id?" do
9
-
10
- context "when the string is id" do
11
-
12
- it "returns true" do
13
- expect ( :id ) . to be_mongoid_id
14
- end
15
- end
16
-
17
- context "when the string is _id" do
18
-
19
- it "returns true" do
20
- expect ( :_id ) . to be_mongoid_id
21
- end
22
- end
23
-
24
- context "when the string contains id" do
25
-
26
- it "returns false" do
27
- expect ( :identity ) . to_not be_mongoid_id
28
- end
29
- end
30
-
31
- context "when the string contains _id" do
32
-
33
- it "returns false" do
34
- expect ( :something_id ) . to_not be_mongoid_id
35
- end
36
- end
37
- end
38
-
39
8
[ :mongoize , :demongoize ] . each do |method |
40
9
41
10
describe ".mongoize" do
You can’t perform that action at this time.
0 commit comments