activerecord-collections 0.0.9 → 0.0.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ce528f513350381a68417cd1b739ddca67c5c4
|
4
|
+
data.tar.gz: ec7a642f1a23c4dfc41cf1ae7f059c263be993c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3965879d213c235ddc447ec1a9d723736af7509aebf7fe4d4749e96a951a4213e1cedadf9dec7acc82035d7ec80b30088db75cc924f95eb91c14519d6d46b1b
|
7
|
+
data.tar.gz: 32445dbdd55347fe201dca00bc1effe2618356e6f3d616f15197d364c925414a34433b42e5d2bdb48934801e4350f52a6693f0423ee9226cc9d6673c486eaca3
|
@@ -53,7 +53,7 @@ module ActiveRecord
|
|
53
53
|
protected
|
54
54
|
|
55
55
|
def initialize(*criteria)
|
56
|
-
if criteria.first.present? && criteria.first.ancestors.include?(ActiveRecord::Base)
|
56
|
+
if criteria.first.present? && criteria.first.respond_to?(:ancestors) && criteria.first.ancestors.include?(ActiveRecord::Base)
|
57
57
|
@collectable = criteria.slice!(0)
|
58
58
|
end
|
59
59
|
|
@@ -8,7 +8,14 @@ module ActiveRecord
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def kollektion
|
11
|
-
|
11
|
+
plural_klass = begin
|
12
|
+
pklass = self.name.pluralize.constantize
|
13
|
+
raise "Not an ActiveRecord::Collection" unless pklass.ancestors.include?(ActiveRecord::Collection)
|
14
|
+
pklass
|
15
|
+
rescue
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
@collection_class || ActiveRecord::Collection.collections.to_a.select { |c| c.collectable == self }.first || plural_klass || ActiveRecord::Collection
|
12
19
|
end
|
13
20
|
|
14
21
|
def collection(*criteria)
|