trailblazer-finder 0.10.1 → 0.10.2

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: 691fee589f1865e7704d021751dfedfa6be1c51950f5812b09de57493ac2d6e4
4
- data.tar.gz: 1919763290c8173d600c4722fa6c1c43a4be4bd70715cc1d05efb963ba5af78b
3
+ metadata.gz: d90691d88aed4c8d7e43ccd1fd4160ed6f445b7915becf4c76bd025ca4d0f661
4
+ data.tar.gz: e66c8f81873325b16f81e2d4ae9b99111f16a704c54d01de24bcac27bdb1d479
5
5
  SHA512:
6
- metadata.gz: 3215baeb3874a0aafe6eb0f4c65f28848ebb08806f26a76e195eb8b9fc9bf8e087a6f64e126ca5d7f0981c42f1cedde892e27e8d882ed799d7ee9e84771d05d8
7
- data.tar.gz: ec4f69e4f75bac9d921bf503381afab35073d0806c65dfd1b1af4382e82ae51f9199098366898429f0dd3f6c22da2dd7977b17bcd8f5b03d08f1a0748cbf19d4
6
+ metadata.gz: c2af6f7a7e82d96a8385d23d88702501881eee63ee2a23e0308a4a2a4eaca9c217721df62479088f03716a1adc3e790f18b32fb26de76685b1e6aef4459d3fe8
7
+ data.tar.gz: 7f44b76f696ce6788584c7a97f703e5e4b4e4ced2a39fded2f672ad3468623f3e161a868bfc6861cdf1d4d5117f1eb57f28ebe0816fae8f78a48b1a7b75c2604
data/CHANGES.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.10.2
2
+ * Add support for ActiveSupport::Hash as params
3
+
1
4
  # 0.10.1
2
5
  * Move activities to Activities folder to avoid conflict with Activity Class.
3
6
 
@@ -17,7 +17,8 @@ module Trailblazer
17
17
  def process_filters(ctx)
18
18
  @params.reduce(@entity) do |entity, (name, value)|
19
19
  value = Utils::String.to_date(value) if Utils::String.date?(value)
20
- new_entity = ctx.instance_exec entity, @filters[name.to_sym][:name], value, &@filters[name.to_sym][:handler]
20
+ filter = @filters[name.to_sym] || @filters[name]
21
+ new_entity = ctx.instance_exec entity, filter[:name], value, &filter[:handler]
21
22
  new_entity || entity
22
23
  end
23
24
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Trailblazer
4
4
  class Finder
5
- VERSION = "0.10.1".freeze
5
+ VERSION = "0.10.2".freeze
6
6
  end
7
7
  end
@@ -49,7 +49,7 @@ Trailblazer::Operation.instance_eval do
49
49
 
50
50
  def apply_id(params)
51
51
  return if params[:id].nil?
52
- params[:id_eq] = params[:id] unless params.key?("id")
52
+ params[:id_eq] = params[:id]
53
53
  end
54
54
  end
55
55
  end
@@ -69,6 +69,14 @@ describe "Trailblazer::Operation - Finder Macro" do
69
69
  expect(result[:finder].name).to eq "product_4"
70
70
  end
71
71
 
72
+ it "Can find a single row by id from ActiveSupport::HashWithIndifferentAccess" do
73
+ params = ActiveSupport::HashWithIndifferentAccess.new({id: 6})
74
+ result = Product::Show.call(params: params)
75
+
76
+ expect(result[:finder].name).to eq "product_5"
77
+ end
78
+
79
+
72
80
  it "Can find a single row by name" do
73
81
  params = {name_eq: "product_2"}
74
82
  result = Product::Show.call(params: params)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer