scoped_search 3.0.0 → 3.0.1

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
2
  SHA1:
3
- metadata.gz: af5bbaee1bcd8c43d9a31e7facd1cbb132b6de4c
4
- data.tar.gz: 3f7bbad05696d74941c0f878b5c9aea2f87ad242
3
+ metadata.gz: 43261f39db1d9b12979b0a8ac09d325b89c31335
4
+ data.tar.gz: 65f7f0cf411208478aee6aa9c7bb11d13036bd88
5
5
  SHA512:
6
- metadata.gz: 1057f7ecafc42146520d82c06ccb045854df6b941b68ffadfae12177888b12582dd79f8ca0d2087a6e22b610545755b77be3e20fa77a7b98ba79bad04f3571b0
7
- data.tar.gz: 8a6795724808b89895fe7eaa90d99fd7f3aef5e5afefd8a178ba6ca70d1a6f2ded74585a56d12af7c841eeb2c76d037af7e980ad9df75005a2561ef2c37715aa
6
+ metadata.gz: 96ec7c114d8d6cde7413eb1a3247540f181694acbaba09044d6d97a65405a87f44f55101b6c868108e8502254762a8a689290038f63ba743c2f67948f5a288ff
7
+ data.tar.gz: 26dc0c35c2547547af5759ba31128dce71784f93f70cecdff67c1cf5c108c81504f827a382249f7e076050fc2ede54ea5330bf1b10cf2fe3993de378466f64f6
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
2
  language: ruby
3
+ cache: bundler
3
4
 
4
5
  sudo: false
5
6
 
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = Scoped search {<img src="https://secure.travis-ci.org/wvanbergen/scoped_search.png" />}[http://travis-ci.org/wvanbergen/scoped_search]
2
2
 
3
- The <b>scoped_search</b> Rails plugin makes it easy to search your ActiveRecord
3
+ The <b>scoped_search</b> gem makes it easy to search your ActiveRecord
4
4
  models. Searching is performed using a query string, which should be passed to
5
5
  the named_scope <tt>search_for</tt>. Based on a definition in what fields to
6
6
  look, it will build query conditions and return those as a named scope.
@@ -27,7 +27,7 @@ Add the following line in your Gemfile, and run <tt>bundle install</tt>:
27
27
  Scoped search requires you to define the fields you want to search in:
28
28
 
29
29
  class User < ActiveRecord::Base
30
- scoped_search :on => [:first_name, :last_name]
30
+ scoped_search on: [:first_name, :last_name]
31
31
  end
32
32
 
33
33
  For more information about options and using fields from relations, see the
@@ -44,12 +44,12 @@ The result is returned as <tt>named_scope</tt>. Because of this, you can
44
44
  actually chain the call with other scopes, or with will_paginate. An example:
45
45
 
46
46
  class Project < ActiveRecord::Base
47
- searchable_on :name, :description
48
- named_scope :public, :conditions => {:public => true }
47
+ scoped_search on: [:name, :description]
48
+ named_scope :public, conditions: { public: true }
49
49
  end
50
50
 
51
51
  # using chained named_scopes and will_paginate in your controller
52
- Project.public.search_for(params[:q]).paginate(:page => params[:page], :include => :tasks)
52
+ Project.public.search_for(params[:q]).paginate(page: params[:page], include: :tasks)
53
53
 
54
54
  === Search profiles
55
55
 
@@ -57,8 +57,8 @@ If you include a :profile option to the scoped_search call, the fields specified
57
57
  be searched when you include this :profile into the search_for command as well:
58
58
 
59
59
  class User < ActiveRecord::Base
60
- scoped_search :on => :public_information
61
- scoped_search :on => :private_information, :profile => :members
60
+ scoped_search on: :public_information
61
+ scoped_search on: :private_information, profile: :members
62
62
  end
63
63
 
64
64
  This will only search the :public_information column:
@@ -67,7 +67,7 @@ This will only search the :public_information column:
67
67
 
68
68
  And this will only search the :private_information column:
69
69
 
70
- User.search_for('blah blah blah', :profile => :members)
70
+ User.search_for('blah blah blah', profile: :members)
71
71
 
72
72
  === More information
73
73
 
@@ -222,8 +222,8 @@ module ScopedSearch
222
222
  def parse_temporal(value)
223
223
  return Date.current if value =~ /\btoday\b/i
224
224
  return 1.day.ago.to_date if value =~ /\byesterday\b/i
225
- return (eval(value.strip.gsub(/\s+/,'.').downcase)).to_datetime if value =~ /\A\s*\d+\s+\bhours?|minutes?\b\s+\bago\b\s*\z/i
226
- return (eval(value.strip.gsub(/\s+/,'.').downcase)).to_date if value =~ /\A\s*\d+\s+\b(days?|weeks?|months?|years?)\b\s+\bago\b\s*\z/i
225
+ return (eval($1.strip.gsub(/\s+/,'.').downcase)).to_datetime if value =~ /\A\s*(\d+\s+\b(?:hours?|minutes?)\b\s+\bago)\b\s*\z/i
226
+ return (eval($1.strip.gsub(/\s+/,'.').downcase)).to_date if value =~ /\A\s*(\d+\s+\b(?:days?|weeks?|months?|years?)\b\s+\bago)\b\s*\z/i
227
227
  DateTime.parse(value, true) rescue nil
228
228
  end
229
229
 
@@ -1,3 +1,3 @@
1
1
  module ScopedSearch
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amos Benari
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-11-21 00:00:00.000000000 Z
13
+ date: 2014-12-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord