rails-simple-search 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +2 -0
  3. data/lib/sql_handler.rb +1 -18
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 846b511052bead878cbb070ce294b6d4fec6d020
4
- data.tar.gz: 86709b8d5c03c106430acbec6fa1842ad117e9c5
3
+ metadata.gz: 1656eabd9d7c1673a5ee1a6bb79f4479853c9880
4
+ data.tar.gz: c8b6452f29fbc836881a8b58dd3fae005466ed0f
5
5
  SHA512:
6
- metadata.gz: 35419c3f2dad173056859163d85d828738bbdcd423c7d1f2734a35c2f65070c373642f6304f6de8e2df19f6ad5cbacc17483928d9e9b4b5e0bec5b534e38ac82
7
- data.tar.gz: 6f1210ba7c22555bad1566c1af0e65ac1f188c8c4f1a06823f4a22fd6c4c7a5436e7259ea1e59dcf9af733a333d297ecb7fbaf7ecbcc6d2aec6e9d2654db8ad8
6
+ metadata.gz: 54e2b78f06735fea938da39c22cb2898b1040513439182c8b4b68e19cdd5af2b1f61418af5c86fa9cbadb50b5c06d0d807ccf277a116a71d5e9984adf326e676
7
+ data.tar.gz: 261e767d7febb21eb0a7e26da6e86eef770e20466adba7bde2be27947e09567a1d1474e693942cf04b085d96dd83e1392204cb630872036757fab381b354d73b
data/README.rdoc CHANGED
@@ -82,6 +82,8 @@ Rails 4.2.
82
82
 
83
83
  From version 1.1.0 on, we started to support the "or" relation, e.g., we can use field like "first_name_or_last_name".
84
84
 
85
+ From version 1.1.3 on, we started to support Rails 5.
86
+
85
87
  There is a real demo application which you can download and run immediately: https://github.com/yzhanginwa/demo_app_for_rails_simple_search
86
88
 
87
89
  == License
data/lib/sql_handler.rb CHANGED
@@ -61,28 +61,11 @@ module RailsSimpleSearch
61
61
  column = base_class.columns_hash[field.to_s]
62
62
  return nil unless column
63
63
 
64
- if !column.text? && value.is_a?(String)
65
- if column.respond_to?(:type_cast)
66
- value = column.type_cast(value)
67
- elsif column.respond_to?(:cast_type)
68
- if column.cast_type.respond_to?(:type_cast)
69
- value = column.cast_type.type_cast(value)
70
- elsif column.cast_type.respond_to?(:type_cast_from_user)
71
- value = column.cast_type.type_cast_from_user(value)
72
- else
73
- raise "something wrong!"
74
- end
75
- else
76
- raise "something wrong!"
77
- end
78
- @criteria[attribute] = value
79
- end
80
-
81
64
  if value.nil?
82
65
  verb = 'is'
83
66
  elsif operator
84
67
  verb = operator
85
- elsif column.text? && ! @config[:exact_match].include?((@table_name == table)? field : key)
68
+ elsif column.type == :string && ! @config[:exact_match].include?((@table_name == table)? field : key)
86
69
  verb = 'like'
87
70
  value = "%#{value}%"
88
71
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-simple-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-03 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: rails-simple-search is a light and easy to use gem. It could help developers
14
14
  quickly build a search page.