active_hash_relation 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e715e9a37b308b7349d0d842fdd7ce7df39b005a
|
4
|
+
data.tar.gz: 54a6f94ae717a4acaa2f8dab2ad0481dd96fe0ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f497e1de1028dfbd9cd5b2c10fd61cf772726edd8b6370570c43ba074bce7748e7f061ec52d29524ea50cb94f43bb2b6421e14ac1e1c56d298860a954f3cd366
|
7
|
+
data.tar.gz: b764c826ccef44218ff0efc522e23815af586dc5c6e48090909bb9156ce510c9ab218083b39df34c4f38891fcb521631af731caf516ed39fbddacd45c121f891
|
@@ -8,17 +8,31 @@ module ActiveHashRelation::AssociationFilters
|
|
8
8
|
if params[association]
|
9
9
|
association_name = association.to_s.titleize.split.join
|
10
10
|
if self.configuration.has_filter_classes
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
if self.configuration.use_unscoped
|
12
|
+
association_filters = self.filter_class(association_name).new(
|
13
|
+
association_name.singularize.constantize.unscoped.all,
|
14
|
+
params[association]
|
15
|
+
).apply_filters
|
16
|
+
else
|
17
|
+
association_filters = self.filter_class(association_name).new(
|
18
|
+
association_name.singularize.constantize.all,
|
19
|
+
params[association]
|
20
|
+
).apply_filters
|
21
|
+
end
|
16
22
|
else
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
if self.configuration.use_unscoped
|
24
|
+
association_filters = ActiveHashRelation::FilterApplier.new(
|
25
|
+
association_name.singularize.constantize.unscoped.all,
|
26
|
+
params[association],
|
27
|
+
include_associations: true
|
28
|
+
).apply_filters
|
29
|
+
else
|
30
|
+
association_filters = ActiveHashRelation::FilterApplier.new(
|
31
|
+
association_name.singularize.constantize.all,
|
32
|
+
params[association],
|
33
|
+
include_associations: true
|
34
|
+
).apply_filters
|
35
|
+
end
|
22
36
|
end
|
23
37
|
resource = resource.joins(association).merge(association_filters)
|
24
38
|
end
|
@@ -48,7 +48,7 @@ module ActiveHashRelation::ColumnFilters
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def filter_boolean(resource, column, param)
|
51
|
-
b_param = ActiveRecord::
|
51
|
+
b_param = ActiveRecord::Type::Boolean.new.type_cast_from_database(param)
|
52
52
|
|
53
53
|
resource = resource.where(column => b_param)
|
54
54
|
end
|
data/lib/active_hash_relation.rb
CHANGED