has_constant 0.2.6 → 0.2.7
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 +2 -2
- data/lib/has_constant/orm/mongoid.rb +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/has_constant.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{has_constant}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mattbeedle"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-20}
|
13
13
|
s.description = %q{Allows certain fields to be limited to a set of values}
|
14
14
|
s.email = %q{mattbeedle@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -45,9 +45,9 @@ module HasConstant
|
|
45
45
|
class_eval do
|
46
46
|
named_scope :by_constant, lambda { |constant,value| { :where =>
|
47
47
|
{ constant.to_sym => eval("#{self.to_s}.#{constant.pluralize}.index(value)") } } }
|
48
|
-
named_scope "#{singular}_is".to_sym, lambda {
|
48
|
+
named_scope "#{singular}_is".to_sym, lambda { |values| { :where =>
|
49
49
|
{ singular.to_sym => { '$in' => values.map { |v| self.send(name.to_sym).index(v) } } } } }
|
50
|
-
named_scope "#{singular}_is_not".to_sym, lambda {
|
50
|
+
named_scope "#{singular}_is_not".to_sym, lambda { |values| { :where =>
|
51
51
|
{ singular.to_sym => { '$nin' => values.map { |v| self.send(name.to_sym).index(v) } } } } }
|
52
52
|
end
|
53
53
|
end
|
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: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- mattbeedle
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-20 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|