has_constant 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/has_constant.gemspec +1 -1
- data/lib/has_constant/orm/mongoid.rb +1 -1
- data/test/unit/orm/mongoid_test.rb +7 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.6
|
data/has_constant.gemspec
CHANGED
@@ -24,7 +24,7 @@ module HasConstant
|
|
24
24
|
class_eval do
|
25
25
|
field singular.to_sym, { :type => Integer }.merge(options)
|
26
26
|
|
27
|
-
index singular.to_sym if options[:index]
|
27
|
+
index singular.to_sym, :background => true if options[:index]
|
28
28
|
|
29
29
|
named_scope :by_constant, lambda { |constant,value| { :where =>
|
30
30
|
{ constant.to_sym => eval("#{self.to_s}.#{constant.pluralize}.index(value)") } } }
|
@@ -38,7 +38,13 @@ class MongoidTest < Test::Unit::TestCase
|
|
38
38
|
|
39
39
|
should 'add index when index option is supplied' do
|
40
40
|
MongoUserWithout.has_constant :salutations, ['Mr', 'Mrs'], :index => true
|
41
|
-
|
41
|
+
MongoUserWithout.create_indexes
|
42
|
+
assert MongoUserWithout.index_information.keys.any? { |key| key.match(/salutation/) }
|
43
|
+
end
|
44
|
+
|
45
|
+
should 'not index when index option is not supplied' do
|
46
|
+
MongoUser.create_indexes
|
47
|
+
assert !MongoUser.index_information.keys.any? { |key| key.match(/salutation/) }
|
42
48
|
end
|
43
49
|
|
44
50
|
should 'save values as integers' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_constant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 6
|
10
|
+
version: 0.4.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- mattbeedle
|