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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a30dbb47b5ea99fedba57a1acc3efd37824e872
4
- data.tar.gz: 24b3f40035d9b2ed970c4b1d3146c8d2ee4d8f69
3
+ metadata.gz: b54d204cd2d065b23eb81feaffc7e44b7939caf8
4
+ data.tar.gz: 20cd3b0ecfa3d99190d86188405c385e0b20c1fa
5
5
  SHA512:
6
- metadata.gz: 42450b984c4313fe080c21b305a85686274b695ea06added6dfd99701eba6483afa808f506307cd0a8aea12a44787b362e1206eb98d6067f6f32ae48fdccf99a
7
- data.tar.gz: 7c8a314aeb5a6848ffad73c929fd857b39cd4c68b7558142e5b4b6689890fc6173286800d8dc6d00dc63f249e87e9eb342179ea390ae1fd14a4e3011ea9cb247
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", "= 4.1.0"
27
- #spec.add_development_dependency "byebug" # travis doenst like byebug
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
- subquery = base.joins(definition.joins).select(primary_key_column)
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 => subquery.select(primary_key_column)).distinct
139
+ base.joins(definition.joins).where(primary_key_column => matches_from_facet).distinct
140
140
  end
141
141
  end
142
142
 
@@ -1,3 +1,3 @@
1
1
  module FortyFacets
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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
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-03-13 00:00:00.000000000 Z
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: 4.1.0
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: 4.1.0
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: