auto_define_scope 0.1.8 → 0.1.9

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
  SHA256:
3
- metadata.gz: 8097cae6bac2456c47729482d4f340db30734545a81166f7c9e8465f841aa32d
4
- data.tar.gz: dd3644b09d1a780ff1fdee8df908662c1d16315683ee25482684b1ed35490d4c
3
+ metadata.gz: 40f8bf51f0ce8e65a5d61bc85f76b50e279cc437de433977ecb401bc8015de15
4
+ data.tar.gz: d97143bdeef56854418f91401c365c5808ceb7850541db53170beee22563251f
5
5
  SHA512:
6
- metadata.gz: df4dc1e4b366d803dd91fd1a7ff7297918aef5b5c7b0a699f9497b751a69023cf278f97575e733daed16c19e94dfaf2d8315b82f597dada5e3a65bfbff846310
7
- data.tar.gz: 333a88df1c19a5bfa61eb3f5e0941dc79f76ab9d5124425a4ee0ade7abea9609818fb717d4c4d9c035afbf3d7b09d86b0791317867120e49ac598f024841f2f2
6
+ metadata.gz: cb68a6f0acfe88cbd6cc037b55e94da4a5f7b80e854f7e1d30983d4ecdcc0cfb833d0259b811cee18062a57f92f16e393583aad500900e99af03dac887c7dfa2
7
+ data.tar.gz: 28dc19bf8aa725fc28e11adeb4fb6f0a96b548990dab174c1bef10fce53f861b0a95e4e112e28a78715f29dbc483cb45342ade60a531b3a1895b244aec8d5dd4
@@ -46,7 +46,6 @@ module AutoDefineScope
46
46
  next
47
47
  end
48
48
  column_type = klass.columns_hash[c.to_s]&.type
49
- binding.pry if column_type
50
49
  raise "scopes defined error, not found column('#{c}') for table #{klass.table_name}" if column_type.nil?
51
50
  joins_params = joins_params_array.reverse.inject() { |a, n| { n => a } }
52
51
  table_name = klass.table_name
@@ -56,11 +55,11 @@ module AutoDefineScope
56
55
  scope scope_name, ->(v) do
57
56
  value = case column_type
58
57
  when :integer
59
- value.to_i
58
+ v.to_i
60
59
  when :string
61
- value.to_s
60
+ v.to_s
62
61
  else
63
- value
62
+ v
64
63
  end
65
64
  value = type == :with ? value : "%#{value}%"
66
65
  joins(joins_params).where("#{table_name}.#{c} #{OPERATE_SQL[type]}", value)
@@ -1,3 +1,3 @@
1
1
  module AutoDefineScope
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_define_scope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - tinyfeng.hou