like_query 0.0.4 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '049ab00db40571bcb74c02122aa68da955b145bd808330336ca5405e9b394c28'
4
- data.tar.gz: 772e0bc35a1fbb766d2ea2e10fa018bfb9445e2aac5b9fff81aed107b9a43887
3
+ metadata.gz: 84fed18b7e4d5122c2d760bdf76c27bcc7094d7e44a140e0b42d8dff1d574827
4
+ data.tar.gz: adb485617d123592abd58140a086073da2745eef15d25a4c84a40635ae1e92f7
5
5
  SHA512:
6
- metadata.gz: 55ad5c0c0bfb442f48b5a9a05fad45ad3fb066c573799dd498ff55f2fb68b1651cf290bde35861d09f4f70fc6cd7cadf65e2b3cdec63bd41ff26bf2876543b07
7
- data.tar.gz: ed8a996db26473442d8ad3e117d387f4c18bef2f13b9d88749ce5ee1ff5ad0f44df0d3506fbc3880ae30b26e7b3c2584f6d96aee9978421ec735a94461ad5f3c
6
+ metadata.gz: 5e7b363e0409f55048163956d485b2b93668eddb3f1de4b49daca8aaffafd2f9866c4a3dfc6abf6b12fecbfdae5e190fe69e8265c162fac97b7e3aff0bfb858d
7
+ data.tar.gz: 4b5a6c0aff2b9a4c1f7c7fa2f08da962e6e4937146a351f8a2c57d8946f2880051a4b1d209a997fbdf4f0eac0e208dcf379603530bc0413b298e8ee8ec6f39e8
@@ -15,6 +15,7 @@ module LikeQuery
15
15
 
16
16
  return false if @length >= @limit
17
17
  length = 0
18
+ @image = image.present?
18
19
 
19
20
  recs = yield
20
21
 
@@ -42,12 +43,12 @@ module LikeQuery
42
43
 
43
44
  if assoc.to_sym == :image
44
45
 
45
- raise 'Missing input: image column for given key :image' unless cols.present?
46
-
47
- # IMAGE COLUMN
48
-
49
- rec_attr[:image] = get_column_value(r, cols)
50
- @image = true
46
+ # raise 'Missing input: image column for given key :image' unless cols.present?
47
+ #
48
+ # # IMAGE COLUMN
49
+ #
50
+ # rec_attr[:image] = get_column_value(r, cols)
51
+ # @image = true
51
52
 
52
53
  else
53
54
 
@@ -68,7 +69,7 @@ module LikeQuery
68
69
  (sub_records.is_a?(Enumerable) ? sub_records : [sub_records]).each do |sub_record|
69
70
  sub_attr = []
70
71
  _cols.each do |c|
71
- sub_attr.push(sub_record.send(c))
72
+ sub_attr.push(get_column_value(sub_record, c))
72
73
  end
73
74
 
74
75
  if @length >= @limit || (limit && length >= limit)
@@ -99,6 +100,7 @@ module LikeQuery
99
100
  rec_attr[:values].push(get_column_value(r, p))
100
101
  rec_attr[:id] = r.id
101
102
  rec_attr[:model] = r.class.to_s.underscore
103
+ rec_attr[:image] = r.send(image) if @image
102
104
 
103
105
  end
104
106
  end
@@ -134,7 +136,7 @@ module LikeQuery
134
136
  def get_column_value(record, column)
135
137
  val = nil
136
138
  column.to_s.split('.').each { |i| val = (val ? val : record).send(i) }
137
- val
139
+ (val ? val : '')
138
140
  end
139
141
 
140
142
  end
@@ -1,3 +1,3 @@
1
1
  module LikeQuery
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: like_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian