mongomodel 0.2.12 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
@@ -181,6 +181,14 @@ module MongoModel
|
|
181
181
|
def ids
|
182
182
|
target.map { |doc| doc.id }
|
183
183
|
end
|
184
|
+
|
185
|
+
def select(*args, &block)
|
186
|
+
if args.empty?
|
187
|
+
target.select(&block)
|
188
|
+
else
|
189
|
+
association.scoped.send(:select, *args)
|
190
|
+
end
|
191
|
+
end
|
184
192
|
|
185
193
|
private
|
186
194
|
def method_missing(method, *args, &block)
|
data/lib/mongomodel/version.rb
CHANGED
@@ -156,6 +156,14 @@ module MongoModel
|
|
156
156
|
|
157
157
|
subject.chapters.all.size.should == 5 # limit clause
|
158
158
|
end
|
159
|
+
|
160
|
+
it "should support scope select method" do
|
161
|
+
subject.chapters.select(:id, :_type, :book_id).should == [chapter1, chapter2]
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should support array select method" do
|
165
|
+
subject.chapters.select { |c| c.is_a?(IllustratedChapter) }.should == [chapter2]
|
166
|
+
end
|
159
167
|
end
|
160
168
|
|
161
169
|
context "new instance with chapters set" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongomodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 13
|
10
|
+
version: 0.2.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Pohlenz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-01 00:00:00 +10:30
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|