tablets 0.3.8 → 0.3.9
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/lib/tablets/data.rb +8 -3
- data/lib/tablets/tablet.rb +5 -3
- data/lib/tablets/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: 238d1476e9dd86d9dd4daffeb15e11db1e4526a4
|
4
|
+
data.tar.gz: 7bd06119e0d5593f011b1ea7aa9f41def63170ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e292ad1d238eb6d39cc70db0754569467a6beb30b6268159f66917043daece16eb79fdf1ba177e1569e503267f2ea75a7ddf864ee357c0fb49a6e3386667073a
|
7
|
+
data.tar.gz: 6de1bee9d84c095e9ddbd9f816eade30fb4c9f6ee15001dda0d00a8f042f808bac2e5896808b7cf4801700a5bef6218978f22ac7b282a0781bb4ae8eae50e848
|
data/lib/tablets/data.rb
CHANGED
@@ -23,15 +23,20 @@ module Tablets
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
attr_reader :params, :tablet
|
26
|
+
attr_reader :params, :tablet, :controller
|
27
27
|
|
28
|
-
# Initializes query with
|
28
|
+
# Initializes query with concrete relation.
|
29
29
|
def query
|
30
|
-
@query ||= Tablets::Data::Query.new(
|
30
|
+
@query ||= Tablets::Data::Query.new(concrete_relation,
|
31
31
|
params,
|
32
32
|
tablet.columns)
|
33
33
|
end
|
34
34
|
|
35
|
+
# Relation with concretized parameters.
|
36
|
+
def concrete_relation
|
37
|
+
tablet.relation(relation_params, controller)
|
38
|
+
end
|
39
|
+
|
35
40
|
# Relation params. Empty hash by default.
|
36
41
|
def relation_params
|
37
42
|
params[:params] || {}
|
data/lib/tablets/tablet.rb
CHANGED
@@ -43,11 +43,13 @@ module Tablets
|
|
43
43
|
|
44
44
|
# Returns database relation to fetch data.
|
45
45
|
# By default tries to deduct class from tablet name.
|
46
|
-
def relation(params = {})
|
46
|
+
def relation(params = {}, controller = nil)
|
47
47
|
if defined? @name.singularize.camelize.constantize
|
48
|
-
call(:relation, params
|
48
|
+
call(:relation, params, controller) do
|
49
|
+
@name.camelize.constantize.where(nil)
|
50
|
+
end
|
49
51
|
else
|
50
|
-
call(:relation, params)
|
52
|
+
call(:relation, params, controller)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
data/lib/tablets/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tablets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yevhen Shemet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|