simple-search 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +65 -4
- data/VERSION +1 -1
- data/simple-search.gemspec +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,68 @@
|
|
1
|
-
=
|
1
|
+
= SimpleSearch
|
2
2
|
|
3
|
-
|
3
|
+
SimpleSearch privides search methods for your ActiveRecord models, by providing methods that allow you to search, group, and order.
|
4
|
+
Main goal is to simplify all search related operations from url.
|
5
|
+
* Searching
|
6
|
+
* Paging
|
7
|
+
* Grouping
|
8
|
+
* Ordering
|
9
|
+
|
10
|
+
== Getting Started
|
11
|
+
|
12
|
+
In your Gemfile:
|
13
|
+
|
14
|
+
gem "simple-search" # Last officially released gem
|
15
|
+
# gem "simple-search", :git => "git://github.com/bighostkim/simple-search.git"
|
16
|
+
|
17
|
+
In your controller:
|
18
|
+
|
19
|
+
def index
|
20
|
+
@posts = Post.simplesearch(params)
|
21
|
+
# or, @posts = Post.simplesearch(params[:ss]) # when group options to "ss"
|
22
|
+
# or, @posts = Post.simplesearch(:id_gt=>1,:id_lt=>3)
|
23
|
+
end
|
24
|
+
|
25
|
+
In your view:
|
26
|
+
|
27
|
+
<%= form_tag('/posts') do -%>
|
28
|
+
<%= text_field_tag 'id_gt' %>
|
29
|
+
<%= text_field_tag 'id_lt' %>
|
30
|
+
.....
|
31
|
+
<%= submit_tag %>
|
32
|
+
<% end -%>
|
33
|
+
|
34
|
+
<%=order_link(:id, "Order by ID" )%>
|
35
|
+
|
36
|
+
<%=page_urls(@posts)%>
|
37
|
+
|
38
|
+
=== Search postfixes
|
39
|
+
|
40
|
+
* _eq, equal to, =
|
41
|
+
* _gt, greater than, >
|
42
|
+
* _lt, less than, <
|
43
|
+
* _le, less or equal to, <=
|
44
|
+
* _ge, greater or equal to, <=
|
45
|
+
* _in, includes, IN
|
46
|
+
i.e., &id_in=1,2,3
|
47
|
+
* _bt(_between), between, BETWEEN
|
48
|
+
i.e., &id_between=1,3
|
49
|
+
* _sw(_startswith), starts with, LIKE 'key%' (
|
50
|
+
* _ew(_endsswith), ends with, LIKE '%key'
|
51
|
+
* _ct(_contains,_like), contains, LIKE '%key%'
|
52
|
+
* _nc(_notcontains,_notlike), not contains, NOT LIKE '%key%'
|
53
|
+
* _is, IS
|
54
|
+
i.e., &id_is=null
|
55
|
+
* _it(_isnot), IS NOT
|
56
|
+
|
57
|
+
=== Sorting your result
|
58
|
+
* order_by
|
59
|
+
i.e., &order_by=id+asc
|
60
|
+
|
61
|
+
=== Paging
|
62
|
+
* page , page number
|
63
|
+
i.e. &page=1
|
64
|
+
* page_by, number of rows in a page
|
65
|
+
i.e. &page_by=10
|
4
66
|
|
5
67
|
== Contributing to simple-search
|
6
68
|
|
@@ -14,6 +76,5 @@ Description goes here.
|
|
14
76
|
|
15
77
|
== Copyright
|
16
78
|
|
17
|
-
Copyright (c) 2012 Allen Kim. See LICENSE.txt for
|
18
|
-
further details.
|
79
|
+
Copyright (c) 2012 Allen Kim. See LICENSE.txt for further details.
|
19
80
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.1
|
data/simple-search.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "simple-search"
|
8
|
-
s.version = "0.10.
|
8
|
+
s.version = "0.10.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Allen Kim"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-15"
|
13
13
|
s.description = "\n\t\tTranslates url commands for searching, paging, sorting, groupion against ActiveRecord and its associations.\n\t\tProvides view helpers including links for order and urls for search, group, and page.\n\t"
|
14
14
|
s.email = "bighostkim@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: simple-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.10.
|
5
|
+
version: 0.10.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Allen Kim
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-15 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
152
|
requirements:
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
hash:
|
155
|
+
hash: 4539108047666923683
|
156
156
|
segments:
|
157
157
|
- 0
|
158
158
|
version: "0"
|