parascope 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.md +20 -0
- data/lib/parascope/query.rb +0 -3
- data/lib/parascope/version.rb +1 -1
- 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: 148749dbca46560b2b152377b8095d27fec8a1a1
|
4
|
+
data.tar.gz: a449da808e60361c33b60b4ba524f272a5b83173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f876d869db3495232e67154fa0bcdb6089f62cc855112deb986b019f6e112c2782cc0158ffd899a1139c095c2ee0bd602e55ee6d3b7557e663a67d9caf4413c
|
7
|
+
data.tar.gz: 000864ff20232cf0d0f85bc74f29febc476dfc6eb668324640962caed100578d7900cc2011b0790978d88be992eaaf80292ec729fdb7c5a46b2e17306eb9dcca
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -306,6 +306,26 @@ query.project_users # => this is the same as:
|
|
306
306
|
# .order("CONCAT(first_name, ' ', last_name) DESC")
|
307
307
|
```
|
308
308
|
|
309
|
+
### A Note on `base_scope` Blocks
|
310
|
+
|
311
|
+
Keep in mind that _all_ `base_scope` blocks are
|
312
|
+
**applied only if query object was initialized without explicit scope option**,
|
313
|
+
i.e. if your Query class has a sifter with mandatory scope modification, and
|
314
|
+
you initialize your query objects with explicit scope, you most likely want
|
315
|
+
to use unoptional `query` block within sifter definition. For example,
|
316
|
+
|
317
|
+
```rb
|
318
|
+
class MyQuery < Parascope::Query
|
319
|
+
sifter :with_projects do
|
320
|
+
query { scope.joins(:projects) }
|
321
|
+
|
322
|
+
# ...
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
query = MyQuery.new(params, scope: some_scope)
|
327
|
+
```
|
328
|
+
|
309
329
|
### Hints and Tips
|
310
330
|
|
311
331
|
- Keep in mind that query classes are just plain Ruby classes. All `sifter`,
|
data/lib/parascope/query.rb
CHANGED
@@ -96,9 +96,6 @@ module Parascope
|
|
96
96
|
singleton_class.instance_exec(*block.values_for(params), &block.block)
|
97
97
|
end
|
98
98
|
params.replace(singleton_class.defaults.merge(params))
|
99
|
-
if instance_variable_defined?('@scope') && !singleton_class.base_scope.nil?
|
100
|
-
@scope = instance_exec(@scope, &singleton_class.base_scope)
|
101
|
-
end
|
102
99
|
@sifted = true
|
103
100
|
end
|
104
101
|
|
data/lib/parascope/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parascope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Kuzko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|