randumb 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/randumb.rb +6 -2
- metadata +3 -3
data/lib/randumb.rb
CHANGED
@@ -35,8 +35,11 @@ module Randumb
|
|
35
35
|
rand_index = rand( id_results.length )
|
36
36
|
ids[rand_index] = id_results[rand_index]["id"] unless ids.has_key?(rand_index)
|
37
37
|
end
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
the_scope = klass.includes(original_includes)
|
40
|
+
# specifying empty selects caused bug in rails 3.0.0/3.0.1
|
41
|
+
the_scope = the_scope.select(original_selects) unless original_selects.empty?
|
42
|
+
records = the_scope.find_all_by_id(ids.values)
|
40
43
|
|
41
44
|
if return_first_record
|
42
45
|
records.first
|
@@ -61,6 +64,7 @@ module Randumb
|
|
61
64
|
|
62
65
|
end # Randumb
|
63
66
|
|
67
|
+
|
64
68
|
# Mix it in
|
65
69
|
class ActiveRecord::Relation
|
66
70
|
include Randumb::ActiveRecord::Relation
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: randumb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Zachary Kloepping
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-11-13 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements: []
|
57
57
|
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.8.
|
59
|
+
rubygems_version: 1.8.11
|
60
60
|
signing_key:
|
61
61
|
specification_version: 3
|
62
62
|
summary: Adds the ability to pull random records from ActiveRecord
|