searchify 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -107,7 +107,7 @@ You can always override the defaults with an initializer. Options are as follow:
107
107
  ### Search stategies
108
108
 
109
109
  By default, Searchify does a case insensitive search on `name`, `title` and `abbreviation` fields of your models, if they exist.
110
- To override the default search strategy, just define a class method named `search_strategy` in your model. It should accepts two arguments and returns an array of hash.
110
+ To override the default search strategy, just define a class method named `search_strategy` in your model. It should accepts two arguments and returns an array of hashes.
111
111
 
112
112
  class User < ActiveRecord::Base
113
113
  def self.search_strategy(term, scopes)
@@ -120,7 +120,7 @@ To override the default search strategy, just define a class method named `searc
120
120
  end
121
121
 
122
122
  scoped.map do |user|
123
- {:label => user.username, :id => resource.id}
123
+ {:label => user.username, :id => user.id}
124
124
  end
125
125
  end
126
126
  end
@@ -129,4 +129,4 @@ You may also want to use a per-search search strategy, without affecting the def
129
129
 
130
130
  <%= searchify :users, :search_strategy => :my_custom_method %>
131
131
 
132
- Searchify will then try to call your `User.my_custom_method`. It must accepts two arguments, and still return a hash.
132
+ Searchify will then try to call your `User.my_custom_method`. It must accepts two arguments, and still return an array of hashes.
@@ -34,7 +34,13 @@ module Searchify
34
34
 
35
35
  params[:search_strategy] = search_strategy if search_strategy
36
36
 
37
- url << params.map{ |k,v| "#{k}=#{v}" }.join('&')
37
+ url << params.map do |k,v|
38
+ if v.kind_of?(Array)
39
+ v.map{ |e| "#{k}[]=#{e}" }
40
+ else
41
+ "#{k}=#{v}"
42
+ end
43
+ end.join('&')
38
44
  end
39
45
 
40
46
  def extract_select_url(action)
@@ -94,7 +100,13 @@ class ActionView::Helpers::FormBuilder
94
100
  url = "#{@template.searchify_path}/search/#{collection}.json?"
95
101
  params[:search_strategy] = search_strategy if search_strategy
96
102
 
97
- url << params.map{ |k,v| "#{k}=#{v}" }.join('&')
103
+ url << params.map do |k,v|
104
+ if v.kind_of?(Array)
105
+ v.map{ |e| "#{k}[]=#{e}" }
106
+ else
107
+ "#{k}=#{v}"
108
+ end
109
+ end.join('&')
98
110
  end
99
111
 
100
112
  def extract_model_name(field)
@@ -1,3 +1,3 @@
1
1
  module Searchify
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,75 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: searchify
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Christian Blais
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-03 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &20084300 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: jquery-rails
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *20084300
25
+ - !ruby/object:Gem::Dependency
26
+ name: jquery-rails
27
+ requirement: &20083720 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: sqlite3
51
34
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *20083720
36
+ - !ruby/object:Gem::Dependency
37
+ name: sqlite3
38
+ requirement: &20083140 !ruby/object:Gem::Requirement
53
39
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
61
44
  type: :development
62
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *20083140
63
47
  description: Searchify provides a quick way to search your collections.
64
- email:
48
+ email:
65
49
  - christ.blais@gmail.com
66
50
  executables: []
67
-
68
51
  extensions: []
69
-
70
52
  extra_rdoc_files: []
71
-
72
- files:
53
+ files:
73
54
  - app/helpers/searchify/searchify_helper.rb
74
55
  - app/assets/javascripts/searchify/searchify.js
75
56
  - app/controllers/searchify/searchify_controller.rb
@@ -115,41 +96,31 @@ files:
115
96
  - test/dummy/public/404.html
116
97
  - test/dummy/public/422.html
117
98
  - test/unit/helpers/searchify/searchify_helper_test.rb
118
- has_rdoc: true
119
99
  homepage: http://github.com/christianblais/searchify
120
100
  licenses: []
121
-
122
101
  post_install_message:
123
102
  rdoc_options: []
124
-
125
- require_paths:
103
+ require_paths:
126
104
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
105
+ required_ruby_version: !ruby/object:Gem::Requirement
128
106
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
112
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
145
117
  requirements: []
146
-
147
118
  rubyforge_project:
148
- rubygems_version: 1.6.1
119
+ rubygems_version: 1.8.10
149
120
  signing_key:
150
121
  specification_version: 3
151
122
  summary: Search with ease!
152
- test_files:
123
+ test_files:
153
124
  - test/test_helper.rb
154
125
  - test/searchify_test.rb
155
126
  - test/integration/navigation_test.rb