searchlight 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5654905b697feb05239ed5b783d46e6a282eaa4
4
- data.tar.gz: 7b9622f4a6d5d9f7cdcc2429941fc08f36e6c491
3
+ metadata.gz: 4ca4e4a2693cd9315c4734f63f2e3cdbb560d8f9
4
+ data.tar.gz: 5182116d73d4fd2da4d2ef187f7be4df210cab7f
5
5
  SHA512:
6
- metadata.gz: 64e8e55512aac81f5bed20ac97152a012211cdfdcb25906f62cb62b52e0a8970eb8111f991b85120f382e57771cea3f23e64edf4d4bcb0673b8983dc12a91f26
7
- data.tar.gz: 491c812aa4973a4cfca1b2948f435a647ab1c59da69ea40414073bd93d780d4619afe5a5c10bebfee1a5509bf8915693abd7723b5e5080db29ef2c7bc5cde29b
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 model_class_for(search_target).columns_hash.keys.include?(attribute_name.to_s)
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
@@ -1,3 +1,3 @@
1
1
  module Searchlight
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/searchlight.gemspec CHANGED
@@ -4,6 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'searchlight/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
+ spec.license = 'MIT'
7
8
  spec.name = "searchlight"
8
9
  spec.version = Searchlight::VERSION
9
10
  spec.authors = ["Nathan Long", "Adam Hunter"]
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.0
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-07-02 00:00:00.000000000 Z
12
+ date: 2013-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: named