tkh_search 0.3.0.2 → 0.4

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: 5c685ecc65b529885b2a54b21c16dd3c8c061414
4
- data.tar.gz: c90399922ce29772b6684613fde557129a9c72fb
3
+ metadata.gz: 9748ff601f15d8ab012357f8728cef710eb84488
4
+ data.tar.gz: c0351037148f0801b3df02527bf15a698303156d
5
5
  SHA512:
6
- metadata.gz: d3615f3ba67314b5a4423ddf43d89c4292b0c253da81ced3d7eae9aeed7d9abcf7b85dd99741c5275d31c5d33bc1167a36be36513a8b3c3f95795c0b938061cd
7
- data.tar.gz: 1f2b5199dc066edde33cd2ab826de85e63a18c8e440890239117c65defdfaae560a33ccd6e9f530efeb8b387c895454caed029db2a5502ee13288b3562fcb53d
6
+ metadata.gz: 5edec205a9a08c8b0d0deab1d5de54dc5d70e5d7cdfe535281873ed0ab4b300933a0b08cf3ac3bba7813850de099e18632cbcdd15eee8d4c6343d1cf5c5dd1d7
7
+ data.tar.gz: cb1367241a31e67ce6656ca1c14c58f1e24f61b07182928dc997ccd43c87f1ca25464c93fd3ed78ef3600600323480b03bc198e2bfcc7316b841c524a0eca2cc
@@ -1,6 +1,11 @@
1
1
  # TKH Search
2
2
 
3
3
 
4
+ ## 0.4
5
+
6
+ * Debugged crashing results when no record was present for the result.
7
+ * Debugged search by locale.
8
+
4
9
 
5
10
  ## 0.3.0.1 & 0.3.0.2
6
11
 
@@ -4,7 +4,6 @@ class SearchController < ApplicationController
4
4
  @query = params[:query].downcase.strip
5
5
  @models_to_search = params[:models_to_search].split
6
6
  @results_css_class = params[:results_css_class] || 'js-search-results'
7
- current_locale = @cl
8
7
  @the_current_locale = I18n.locale
9
8
  token = SecureRandom.base64
10
9
  search_terms = []
@@ -12,8 +11,8 @@ class SearchController < ApplicationController
12
11
  search_terms << TkhSearchTerm.find_or_create_by( word: query_word )
13
12
  end
14
13
  search_terms.each do |search_term|
15
- if search_term.tkh_search_instances.for_locale(current_locale).any?
16
- search_term.tkh_search_instances.for_locale(current_locale).each do |search_instance|
14
+ if search_term.tkh_search_instances.for_locale(@the_current_locale).any?
15
+ search_term.tkh_search_instances.for_locale(@the_current_locale).each do |search_instance|
17
16
  if @models_to_search.include? search_instance.host_model_name
18
17
  search_result = TkhSearchResult.find_or_create_by(
19
18
  token: token,
@@ -1,7 +1,11 @@
1
1
  <ul class="search-results">
2
2
  <% if search_results.any? %>
3
3
  <% search_results.each do |result| %>
4
- <% record = (Kernel.const_get result.host_model_name).find(result.model_record_id) %>
4
+ <% begin %>
5
+ <% record = (Kernel.const_get result.host_model_name).find(result.model_record_id) %>
6
+ <% rescue %>
7
+ next
8
+ <% end %>
5
9
  <% if defined? record.name %>
6
10
  <% link_label = record.name %>
7
11
  <% elsif defined? record.title %>
@@ -9,11 +13,11 @@
9
13
  <% else %>
10
14
  <% link_label = 'no title or name' %>
11
15
  <% end %>
12
- <%= content_tag :li,
13
- "<span class='sr-model-name'>#{result.host_model_name}</span> -
14
- <span class='sr-record-link'>#{link_to link_label, record}</span> -
15
- <span class='sr-rating'>#{result.rating}</span>
16
- ".html_safe
16
+ <%= content_tag( :li,
17
+ "<span class='sr-model-name'>#{result.host_model_name}</span> -
18
+ <span class='sr-record-link'>#{link_to link_label, record}</span> -
19
+ <span class='sr-rating'>#{result.rating}</span>
20
+ ".html_safe) unless link_label == 'no title or name'
17
21
  %>
18
22
  <% end %>
19
23
  <% else %>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <h3>The index ...</h3>
4
4
 
5
- <p>... has <strong><%= TkhSearchTerm.count %></strong> different search terms pointing to <strong><%= TkhSearchInstance.count %></strong> instances.</p>
5
+ <p>... has <strong><%= number_with_delimiter TkhSearchTerm.count, delimiter: ',' %></strong> different search terms pointing to <strong><%= number_with_delimiter TkhSearchInstance.count, delimiter: ',' %></strong> instances.</p>
6
6
 
7
7
  <h3>Total User Searches</h3>
8
8
 
@@ -1,3 +1,3 @@
1
1
  module TkhSearch
2
- VERSION = "0.3.0.2"
2
+ VERSION = "0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.2
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swami Atma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord