mongoid-dsl 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/mongoid-dsl/monkey.rb +7 -40
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47808c4061e31b1839ec661b8c922f503215ac15
|
4
|
+
data.tar.gz: d01fac305de47f5936409eb3f6b53760f2732731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d367c54d6e0759f727ad1480de130666350a0ab90b12f097db2632581af72c4ba2691189bfaf52ae0ac4ab0f9ab8157fd100f3ae857ea80e30a94059e4c2a36
|
7
|
+
data.tar.gz: 572c3645fe47dd7dc7a4bc11bbc02235257a8df073f9bfd0fe6cb487278b3a03f9d3297f134497533819ded25705657026d0bbeb103772c125f496a096ad9a0a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.1
|
data/lib/mongoid-dsl/monkey.rb
CHANGED
@@ -330,9 +330,9 @@ module Mongoid
|
|
330
330
|
begin
|
331
331
|
|
332
332
|
deep_level = (full_path.count) || 0
|
333
|
-
chains= full_path
|
333
|
+
chains = full_path
|
334
334
|
|
335
|
-
if !full_path.
|
335
|
+
if !full_path.nil? && !full_path.empty?
|
336
336
|
full_path= full_path.join('.')+'.'
|
337
337
|
else
|
338
338
|
full_path= String.new
|
@@ -467,22 +467,6 @@ module Mongoid
|
|
467
467
|
|
468
468
|
end
|
469
469
|
|
470
|
-
# TODO find out how to add elements to a criteria obj
|
471
|
-
# # convert to mongid criteria
|
472
|
-
# begin
|
473
|
-
#
|
474
|
-
# mongoid_crit= Mongoid::Criteria.new(self)
|
475
|
-
#
|
476
|
-
# puts mongoid_crit.methods - Object.methods
|
477
|
-
#
|
478
|
-
#
|
479
|
-
# mongoid_crit.add_to_set return_data[0]
|
480
|
-
#
|
481
|
-
# return mongoid_crit
|
482
|
-
#
|
483
|
-
# rescue Exception
|
484
|
-
# end
|
485
|
-
|
486
470
|
return return_data
|
487
471
|
|
488
472
|
end
|
@@ -495,29 +479,12 @@ module Mongoid
|
|
495
479
|
end
|
496
480
|
|
497
481
|
def _find(target_id)
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
if target_id.class != Moped::BSON::ObjectId && target_id.class != String
|
502
|
-
raise ArgumentError, "id parameter must be id or ObjectId"
|
503
|
-
end
|
504
|
-
end
|
505
|
-
|
506
|
-
# Do the Gangnam style
|
507
|
-
begin
|
508
|
-
return_doc = self._where( '_id' => target_id )[0]
|
509
|
-
end
|
510
|
-
|
511
|
-
return return_doc
|
482
|
+
return self._where(
|
483
|
+
'_id' => Moped::BSON::ObjectId.from_string(target_id.to_s)
|
484
|
+
)[0]
|
512
485
|
end
|
513
486
|
def _find_by(*args)
|
514
|
-
|
515
|
-
# Do the Gangnam style
|
516
|
-
begin
|
517
|
-
return_array = self._where(*args).first
|
518
|
-
end
|
519
|
-
|
520
|
-
return return_array
|
487
|
+
return self._where(*args).first
|
521
488
|
end
|
522
489
|
|
523
490
|
#> [:none,:self,:one,:many]
|
@@ -604,7 +571,7 @@ module Mongoid
|
|
604
571
|
|
605
572
|
Mongoid.models.each do |model_name|
|
606
573
|
mongoid_model_name= model_name.mongoid_name
|
607
|
-
|
574
|
+
if [mongoid_model_name,mongoid_model_name+'s'].any?{|mn| self.to_s == mn }
|
608
575
|
return model_name.to_s.constantize
|
609
576
|
end
|
610
577
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|