forty_facets 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/forty_facets.gemspec +2 -2
- data/lib/forty_facets/filter/facet_filter_definition.rb +4 -4
- data/lib/forty_facets/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b54d204cd2d065b23eb81feaffc7e44b7939caf8
|
4
|
+
data.tar.gz: 20cd3b0ecfa3d99190d86188405c385e0b20c1fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8766e626bcc171d0d1ca27f8e138b2cf98ea5852dc6fcbca58349060aa27941caa2888c343ed102dbc797da664a2e7bfbf86dc92c96dcc1534a4e0401880c7c6
|
7
|
+
data.tar.gz: 4b9220bd040166462ba4ad4ae684908b71a6b8af46c0b9eec6d5a916b2781cd87be12a709294e7ad1bde506a85f983dd08248d704056879c2dce58511604bc6f
|
data/forty_facets.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "minitest"
|
24
24
|
spec.add_development_dependency "sqlite3"
|
25
25
|
spec.add_development_dependency "coveralls"
|
26
|
-
spec.add_development_dependency "activerecord", "
|
27
|
-
|
26
|
+
spec.add_development_dependency "activerecord", "~> 5.0"
|
27
|
+
spec.add_development_dependency "byebug" # travis doenst like byebug
|
28
28
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'byebug'
|
2
|
+
|
1
3
|
module FortyFacets
|
2
4
|
class FacetFilterDefinition < FilterDefinition
|
3
5
|
|
@@ -129,14 +131,12 @@ module FortyFacets
|
|
129
131
|
return Proc.new { |base| base } if empty?
|
130
132
|
Proc.new do |base|
|
131
133
|
base_table = definition.origin_class.table_name
|
132
|
-
join_name = [definition.association.name.to_s, base_table.to_s].sort.join('_')
|
133
134
|
|
134
135
|
primary_key_column = "#{base_table}.#{definition.origin_class.primary_key}"
|
135
136
|
|
136
|
-
|
137
|
-
.where("#{join_name}.#{definition.association.foreign_key}" => values).uniq
|
137
|
+
matches_from_facet = base.joins(definition.joins).where("#{definition.association.klass.table_name}.#{definition.association.klass.primary_key}" => values).select(primary_key_column)
|
138
138
|
|
139
|
-
base.joins(definition.joins).where(primary_key_column =>
|
139
|
+
base.joins(definition.joins).where(primary_key_column => matches_from_facet).distinct
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
data/lib/forty_facets/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forty_facets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Axel Tetzlaff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,16 +84,30 @@ dependencies:
|
|
84
84
|
name: activerecord
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '5.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
95
102
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: FortyFacets lets you easily build explorative search interfaces based
|
98
112
|
on fields of your active_record models.
|
99
113
|
email:
|