activerecord-search 0.1.2 → 0.1.3

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: 66424d855ddac9ed35064020d1ebbf8e0eb308d6
4
- data.tar.gz: 5eb31b26e13293807200892142a65d3f75d76a40
3
+ metadata.gz: 0ea2eb37263ed57ec94855245252fa3b2e4d9533
4
+ data.tar.gz: 841a3dd45c6c3f4727063f107e79a3b5800cf944
5
5
  SHA512:
6
- metadata.gz: e8bccbf18afdb95ab10a1ad5d8685cd19345e64bbd06bc37c187d67fce1d75397648f7824aa6ee73c0cdb3b0ce825cf24189d3842f3f99fbe0b4af1ddd231761
7
- data.tar.gz: 2a84a63494fcc96cef6825cb7e0e22a080eac8b830256254e87091ffd6c5be0cecbd6aff148b8fd2a12d610349dd60d48c4ecb7d6d9eaddf8c9c3cbbc33f411e
6
+ metadata.gz: a667e9364b0c67a634a1fd857716b9d18a218287d73f6704ff2e1d55e14e1588f5d9ba6f35696d77576a23bb4b46b1c8f59a1c2fa139363771871c2a9488bb16
7
+ data.tar.gz: 7af59258299b859babe7509ac1076e206afef4e95f0764c5b14ed841995a8425f3b84de3934ec99d6e80e28a45c3959cd37234ea8c4ce5a9071dc15bc09535e7
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
 
40
40
  spec.add_development_dependency "bundler", "~> 1.10"
41
41
  spec.add_development_dependency "rake", "~> 10.0"
42
- spec.add_development_dependency "activerecord", '~> 0'
43
- spec.add_development_dependency "sqlite3", '~> 0'
44
- spec.add_development_dependency "minitest", '~> 0'
42
+ spec.add_development_dependency "activerecord", '~> 0.1'
43
+ spec.add_development_dependency "sqlite3", '~> 0.1'
44
+ spec.add_development_dependency "minitest", "5.8.1"
45
45
  end
@@ -17,12 +17,14 @@ module ActiveRecord
17
17
  class << #{subclass}
18
18
  attr_reader :search_option, :search_fields
19
19
 
20
- def search_#{subclass.to_s.underscore}(words, option = nil)
20
+ def search_#{subclass.to_s.underscore}(words, option = nil, fields = [])
21
21
  formatted_words = format_search(words, option)
22
22
 
23
+ fields = fields.empty? ? @search_fields.dup : fields
24
+
23
25
  search_scope = []
24
26
  search_params = {}
25
- @search_fields.each do |field|
27
+ fields.each do |field|
26
28
  search_params[field] = formatted_words
27
29
  search_scope << field.to_s + " LIKE :" + field.to_s
28
30
  end
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module Search
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehdi FARSI
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '0.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '0.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 5.8.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 5.8.1
83
83
  description: a lightweight search-engine using ActiveRecord
84
84
  email:
85
85
  - mehdifarsi.pro@gmail.com