rails-simple-search 1.1.7 → 1.1.8

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
- SHA1:
3
- metadata.gz: 97179f7794faea8e0aa2b3100b6be0b40a4a5399
4
- data.tar.gz: 130d3e3862abe9fb11672c29d24be6524ede71ca
2
+ SHA256:
3
+ metadata.gz: 25a52a9d4df55218b58ed0bfd14fd26b83d1073a9e7cf595ad43d6614e6b1bb8
4
+ data.tar.gz: 304a1ac4d8784efa69d5ecaa5f6f16b891b26ab45e01a686684b40a0beac64f8
5
5
  SHA512:
6
- metadata.gz: 11ae23b082afd9ee052d85fa5f424c56a219309141ad34f442bf2e679028fff79fcdc1215b2efb64d1cbe26574887469c788e2164ac003aca6acc7fe067ca43b
7
- data.tar.gz: 403a0bdfb53d743e6d89c9594f763123049de37eb7e76ddc1b86da8c9fee7bd116d1827e7be0ab3f50fd418d7f26d4c02fcabae4ba4ee67537d7a5420a3e2fd2
6
+ metadata.gz: 4f6efabcecb4eaaddfe0380a56456c9351fdcab77406156e213238a4df1c9cb3e38ca850b91677e3ecba80e4bb245096d293759f02b622055e138f1a1d8319e4
7
+ data.tar.gz: 879154bc961b75adf9374a199b8403232c5db5601326aa42f49ebfaa119a1e96eafad63b3827bf5f5bc52f74e9dc4b8747c43b09f77fe5e026c6714d0fc94e7b
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = rails-simple-search
1
+ =rails-simple-search
2
2
 
3
3
  rails-simple-search is a Ruby gem. It helps you quickly implement searching/filtering function for your web site. This plugin has paginating feature built in. If you're not looking for a full-text searching solution, this plugin will most probably satisfy all your searching requirement.
4
4
 
@@ -41,7 +41,7 @@ The following is how we implement this searching function with rails-simple-sear
41
41
 
42
42
  4. Code in views:
43
43
 
44
- <% form_for @search, url => "/xxxxxx" do |f| %>
44
+ <% form_for @search, url => "/xxxxxx", data: {turbo: false} do |f| %>
45
45
 
46
46
  <%=f.label :email %>
47
47
  <%=f.text_field :email %>
@@ -69,7 +69,7 @@ The following is how we implement this searching function with rails-simple-sear
69
69
  <% end %>
70
70
 
71
71
  5. Add route for the post to url "/xxxxxx" (config/route.rb)
72
- match "/xxxxxx" => "yyyyyyy#zzzzzz"
72
+ post "/xxxxxx" => "yyyyyyy#zzzzzz"
73
73
 
74
74
  == Note
75
75
 
@@ -84,8 +84,12 @@ From version 1.1.0 on, we started to support the "or" relation, e.g., we can use
84
84
 
85
85
  From version 1.1.3 on, we started to support Rails 5.
86
86
 
87
+ For Rails 7, please use version 1.1.7.
88
+
87
89
  There is a real demo application which you can download and run immediately: https://github.com/yzhanginwa/demo_app_for_rails_simple_search
88
90
 
91
+ For Rails 7 demo, please see here: https://github.com/yzhanginwa/rails_simple_search_demo
92
+
89
93
  == License
90
94
 
91
95
  Copyright (c) 2012 [Yi Zhang], released under the MIT license
@@ -12,6 +12,8 @@ module RailsSimpleSearch
12
12
  end
13
13
 
14
14
  class Base
15
+ attr_reader :criteria
16
+
15
17
  def self.inherited(subclass)
16
18
  class << subclass
17
19
  # in rails 3, the call to "form_for" invokes the model_name
@@ -25,11 +27,13 @@ module RailsSimpleSearch
25
27
  end
26
28
 
27
29
  def self.pre_process(model_name, &procedure)
30
+ model_name.each { |internal_model_name| pre_process(internal_model_name, &procedure) } if model_name.is_a?(Array)
28
31
  @pre_processors ||= {}
29
32
  @pre_processors[model_name] = procedure
30
33
  end
31
34
 
32
35
  def self.pre_processor(model_name)
36
+ @pre_processors ||= {}
33
37
  @pre_processors[model_name]
34
38
  end
35
39
 
@@ -57,17 +61,16 @@ module RailsSimpleSearch
57
61
  end
58
62
 
59
63
  def add_conditions(h={})
60
- @criteria.merge!(h)
64
+ @criteria.merge!(h.stringify_keys)
61
65
  end
62
66
 
63
67
  def remove_criteria(key)
64
- value = @criteria[key]
65
- @criteria.delete(key)
66
- value
68
+ key.each { |internal_key| remove_criteria(internal_key) } if key.is_a?(Array)
69
+ @criteria.delete(key.to_s)
67
70
  end
68
71
 
69
72
  def append_criteria(key, value)
70
- @criteria[key] = value
73
+ @criteria[key.to_s] = value
71
74
  end
72
75
 
73
76
  private
@@ -107,7 +110,7 @@ module RailsSimpleSearch
107
110
  c[key] = value
108
111
  end
109
112
  end
110
- c
113
+ c.stringify_keys
111
114
  end
112
115
  end
113
116
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-simple-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2023-12-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: rails-simple-search is a light and easy to use gem. It could help developers
14
14
  quickly build a search page.
@@ -39,8 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements: []
42
- rubyforge_project:
43
- rubygems_version: 2.5.1
42
+ rubygems_version: 3.3.26
44
43
  signing_key:
45
44
  specification_version: 4
46
45
  summary: A very simple and light gem to quickly build search/filter function in rails