activerecord-search 0.1.4 → 0.2.0

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: 505c3318fe4f551c67580c21fbc734fd7312a75e
4
- data.tar.gz: 223897fdcc13caf76170f7dd2f973cd5743ca71d
3
+ metadata.gz: 217894347fbc21e9e8da4a2f689545b07e40d686
4
+ data.tar.gz: 65347e45036d075da50cbb653c649c787a2c5241
5
5
  SHA512:
6
- metadata.gz: 550dd9c0586e130c3128456ee7bc6c9ade52651555b0474c421c5f7d8eb34c84f4cc28fef63742a36c877ea67674f37a260c2808b051ebe3dd4d1f3e8ca8e7cf
7
- data.tar.gz: 3c6c7e321d4f0618bc0e4c7ba5b984be45400bd534279a6e1f16a2ca830a67a23205eda2840c73a2207ea1009a762bf100581951970633e174adc5fef0983705
6
+ metadata.gz: 0d46b3eab25c60f7f1efac04c6888331fbf154dffbca141e353a4f6afccc31b08dc90c59867f86cb48bff6bf241a5c23f5a330a684874da904d6714eda8c7651
7
+ data.tar.gz: ab40537696a950a5f04cf8be2c60e6ac6cafc788819ddb0f803a13c89842e6829200e3dde031659f47873f983197f9a5802ffb33aff162fed8c4d3756247da7d
@@ -32,13 +32,23 @@ module ActiveRecord
32
32
  where([search_scope.join(" OR "), search_params])
33
33
  end
34
34
 
35
+ def start_with(words)
36
+ search_#{subclass.to_s.underscore}(words, :start_with)
37
+ end
38
+
39
+ def end_with(words)
40
+ search_#{subclass.to_s.underscore}(words, :end_with)
41
+ end
42
+
43
+ def search_anywhere(words)
44
+ search_#{subclass.to_s.underscore}(words, :anywhere)
45
+ end
46
+
35
47
  def search_fields(fields)
36
48
  @search_fields = [fields].flatten
37
49
  end
38
50
  alias_method :search_field, :search_fields
39
51
 
40
-
41
- # If options are given, they override the default options behavior
42
52
  def format_search(words, option)
43
53
  if !option.nil?
44
54
  format_with_option(words, option)
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module Search
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
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.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehdi FARSI