scoped-search 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -119,6 +119,19 @@ Then in your views, you may use the order_for_scoped_search view helper like thi
119
119
  ...
120
120
  </pre>
121
121
 
122
+ h2. Scopes with no arguments and excluded scopes
123
+
124
+ If a scope attribute in the ScopedSearch object has a value that equals to "true", the scope will be chained without any parameters.
125
+ If the scope attribute has a value that is blank? or equals to "false", the scope will be rejected and won't be chained in the search.
126
+
127
+ Example :
128
+
129
+ <pre>
130
+ search = User.scoped_search({ :accepted => "true", :rejected => "", :refused => "false", :has_email => ["foo@bar.com", "bar@foo.com"] })
131
+
132
+ search.all # => results in User.accepted.has_email(["foo@bar.com", "bar@foo.com"])
133
+ </pre>
134
+
122
135
  h2. Issue with single Array attribute and multi parameters scopes
123
136
 
124
137
  When you define a scope, you may define it with a single value that accepts an array, or as a multi parameters scope.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -103,8 +103,8 @@ class ScopedSearch
103
103
  def scoped_order(*columns_names)
104
104
  if defined?(Mongoid) && self.include?(Mongoid::Document)
105
105
  columns_names.each do |column_name|
106
- scope :"ascend_by_#{column_name}", order_by([column_name.to_sym, :desc])
107
- scope :"descend_by_#{column_name}", order_by([column_name.to_sym, :asc])
106
+ scope :"ascend_by_#{column_name}", order_by([column_name.to_sym, :asc])
107
+ scope :"descend_by_#{column_name}", order_by([column_name.to_sym, :desc])
108
108
  end
109
109
  else
110
110
  columns_names.each do |column_name|
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{scoped-search}
8
- s.version = "0.7.0"
8
+ s.version = "0.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["slainer68"]
12
- s.date = %q{2010-08-04}
12
+ s.date = %q{2010-09-14}
13
13
  s.description = %q{Easily implement search forms and column ordering based on your models scopes. For Rails 3, compatible with ActiveRecord and Mongoid.}
14
14
  s.email = %q{slainer68@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped-search
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 0
10
- version: 0.7.0
9
+ - 1
10
+ version: 0.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - slainer68
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-04 00:00:00 +02:00
18
+ date: 2010-09-14 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency