apill 2.3.3 → 2.4.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: 84cdbb1edbe6823c31603457adf4e28647ae92d4
4
- data.tar.gz: ce3b2f2cd39ab8c954bb8f969dce56ee632a82c3
3
+ metadata.gz: b5498c8281d815067fb85ece899fdf7e2e4ccc3f
4
+ data.tar.gz: 78fd720e12713bbcc9f91046bebd97864ba9e003
5
5
  SHA512:
6
- metadata.gz: 14ac59381e4af74ed3712e93eaecdcd4b3ddb0ca45e625726020e8151e71ccba9e5ec442a3c1a67bf0680b38343929c3da6a437399899dc855d4edfe2381935c
7
- data.tar.gz: cea48add76380d77070d4ca115d29910a495e13d50a0d0bb2399dec04131b7393ecee3fd294eb2939091d079f2efaa51395cb0883d1da4fb98c9416997da36ab
6
+ metadata.gz: 81dae0913ba160e54c76c42606e2b21101d29efe23bd05b00df0a635a25a38a1653d7cd167c3e96a53c7fa170595e1f0aef47ea09b01134c95361b0cf8529fad
7
+ data.tar.gz: 840617d643e3b4a2a3030dd26765237896e394c4cf41a31ee368fb21ce372337cb56d0ae07163f9eb92dab940e3cd743a3c88fc006fdc436ad22167a38c0ddb5
@@ -40,16 +40,26 @@ module Queryable
40
40
 
41
41
  def filtered_resource
42
42
  @filtered_resource ||= begin
43
- resource = if defined? super
44
- super
45
- else
46
- send(queryed_model_name)
47
- end
43
+ resource = if defined? super
44
+ super
45
+ else
46
+ send(queryed_model_name)
47
+ end
48
+ resource_class = if resource.respond_to? :klass
49
+ resource.klass
50
+ else
51
+ resource
52
+ end
48
53
 
49
54
  sanitized_query_params.reduce(resource) do |query_resource, query_param|
50
- key, value = query_param
55
+ key, value = query_param
56
+ query_method_name = query_method_name_for(key, resource_class).to_sym
51
57
 
52
- query_resource.public_send(query_method_name_for(key, query_resource), value)
58
+ if resource_class.method(query_method_name).arity == 0
59
+ query_resource.public_send(query_method_name)
60
+ else
61
+ query_resource.public_send(query_method_name, value)
62
+ end
53
63
  end
54
64
  end
55
65
  end
data/lib/apill/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Apill
2
- VERSION = '2.3.3'
2
+ VERSION = '2.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apill
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.3
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-24 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: human_error