searchlight 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/searchlight/adapters/active_record.rb +20 -1
- data/lib/searchlight/version.rb +1 -1
- data/searchlight.gemspec +1 -0
- 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: 4ca4e4a2693cd9315c4734f63f2e3cdbb560d8f9
|
4
|
+
data.tar.gz: 5182116d73d4fd2da4d2ef187f7be4df210cab7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b65c23ac4951fde9cd7810ee92fb4374838efc3df42cbd4861439098516557bccd500d08a3f1d135dcf562a78114438cfff3a82af296df6ce13fd73e4b4216
|
7
|
+
data.tar.gz: 0963fe2edc3ced89da8c97132425bbe1152a38445ebe168537d20a1af21bed960faaf38f3709b740327727d951de3e764621409242aac9eadd00e27494cd5b2f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Searchlight does its best to use [semantic versioning](http://semver.org).
|
4
4
|
|
5
|
+
## v1.3.1
|
6
|
+
|
7
|
+
Add license to gemspec, thanks to notice from Benjamin Fleischer - see [his blog post](http://www.benjaminfleischer.com/2013/07/12/make-the-world-a-better-place-put-a-license-in-your-gemspec/)
|
8
|
+
|
5
9
|
## v1.3.0
|
6
10
|
|
7
11
|
New Mongoid adapter, thanks to [iliabylich](https://github.com/iliabylich).
|
@@ -20,7 +20,7 @@ module Searchlight
|
|
20
20
|
|
21
21
|
eval_string = attribute_names.map { |attribute_name|
|
22
22
|
model_class = model_class_for(search_target)
|
23
|
-
if
|
23
|
+
if model_has_db_attribute?(attribute_name.to_s)
|
24
24
|
|
25
25
|
<<-UNICORN_BILE
|
26
26
|
def search_#{attribute_name}
|
@@ -40,6 +40,25 @@ module Searchlight
|
|
40
40
|
|
41
41
|
@ar_searches_module.module_eval(eval_string, __FILE__, __LINE__)
|
42
42
|
end
|
43
|
+
|
44
|
+
# The idea here is to provide a means to allow users to bypass the check if it causes problems (e.g. during
|
45
|
+
# `rake assets:precompile` if the DB has yet to be created). To bypass this, a user could monkey patch as
|
46
|
+
# follows:
|
47
|
+
#
|
48
|
+
# module Searchlight::Adapters::ActiveRecord::Search
|
49
|
+
# def model_has_db_attribute?(attribute_name)
|
50
|
+
# model_class_for(search_target).columns_hash.keys.include?(attribute_name)
|
51
|
+
# rescue StandardError
|
52
|
+
# true
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# Alternatively, they could monkey-patch Searchlight::Adapters::ActiveRecord::Search::model_has_db_attribute
|
57
|
+
# to simply always return true, though they would then not get the benefit of the improved error messaging.
|
58
|
+
#
|
59
|
+
def model_has_db_attribute?(attribute_name)
|
60
|
+
model_class_for(search_target).columns_hash.keys.include?(attribute_name)
|
61
|
+
end
|
43
62
|
end
|
44
63
|
|
45
64
|
protected
|
data/lib/searchlight/version.rb
CHANGED
data/searchlight.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Long
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: named
|