searcher 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/searcher/version.rb +1 -1
- data/lib/searcher.rb +2 -2
- data/searcher.sqlite3 +0 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/searcher/version.rb
CHANGED
data/lib/searcher.rb
CHANGED
@@ -12,10 +12,10 @@ ActiveRecord::Base.extend(Searcher::ClassMethods)
|
|
12
12
|
|
13
13
|
ActiveSupport.on_load(:after_initialize) do
|
14
14
|
Searcher.classes.each do |klass|
|
15
|
-
table =
|
15
|
+
table = klass.arel_table
|
16
16
|
klass.searcher[:labels].each do |name, config|
|
17
17
|
association = klass.reflect_on_association(config[:from])
|
18
|
-
association_table =
|
18
|
+
association_table = association.klass.arel_table
|
19
19
|
if [:has_and_belongs_to_many, :belongs_to].include?(association.macro)
|
20
20
|
scope = lambda { |q, field| klass.joins(config[:from]).where(association_table[field].eq(q)) }
|
21
21
|
klass.scope "by_#{name}", scope
|
data/searcher.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors: []
|
13
13
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-18 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|