mongoid-dsl 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/mongoid-dsl/fields-ext.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07cba5496b2f12f68d75578a881013f36b133288
|
4
|
+
data.tar.gz: 478b9e6aea688f647d828e4c165f79c6d2fba26b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61812e613671a67fd4c76bfb4e8d00194782f230b374828859bc53f8357d034f695b71c13dc03b60710e9a7ca8de2d6cfb8823a6ce0227a093a05010b3c028b5
|
7
|
+
data.tar.gz: f791fc0ff404285a5b5a1e372119f6b3bbba55666170ff4d47c8dfd1de99485b4eea0da53e6c22d7de633f111197e45daf4814d017ecdf2ea425a2ee1ea4f399
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
@@ -181,3 +181,30 @@ end
|
|
181
181
|
|
182
182
|
end
|
183
183
|
end
|
184
|
+
|
185
|
+
[:hidden,:hide].each do |name_to_use|
|
186
|
+
Mongoid::Fields.option name_to_use do |model, field, value|
|
187
|
+
|
188
|
+
field.instance_variable_get('@options')[:hidden]= field.instance_variable_get('@options').delete(name_to_use)
|
189
|
+
|
190
|
+
model.instance_eval do
|
191
|
+
|
192
|
+
begin
|
193
|
+
self.class_variable_get(:@@mongoid_dsl_hidden_fields)
|
194
|
+
rescue NameError
|
195
|
+
|
196
|
+
self.class_variable_set :@@mongoid_dsl_hidden_fields, []
|
197
|
+
[:hidden,:hide].each { |sym| scope sym, -> { without(*self.class_variable_get(:@@mongoid_dsl_hidden_fields)) } }
|
198
|
+
|
199
|
+
unless default_scoping?
|
200
|
+
default_scope -> { hidden }
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
self.class_variable_get(:@@mongoid_dsl_hidden_fields).push(field.instance_variable_get(:@name)) if !!value
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|