active_interaction 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/active_interaction.rb +1 -1
- data/lib/active_interaction/filters/abstract_date_time_filter.rb +2 -2
- data/lib/active_interaction/filters/array_filter.rb +9 -3
- data/lib/active_interaction/filters/object_filter.rb +1 -1
- data/lib/active_interaction/version.rb +1 -1
- data/spec/active_interaction/integration/array_interaction_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12ca7dc31a385a251040b047f2ebbd4021b66e42
|
4
|
+
data.tar.gz: e7b0bccef0972305632647ea92a7900befce5b8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b59c1e221db8a9ac461ed422c35d1b0df70991cb7202c7c29f4e3d6da258db91e520d839cb2fdc442e43a21d4f56c575e677ed192adbe7e1c98c78b64da197f
|
7
|
+
data.tar.gz: 2a418966e8f5d576a610d96aec2b79242398fcab79c55c624317eab94509099d8d0fe3eaba92a4804320fff299bf7786ce15d571755918c005d61b937989dac3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# [2.1.3][] (2015-10-02)
|
2
|
+
|
3
|
+
## Fixed
|
4
|
+
|
5
|
+
- [#303][]: Allowed ActiveRecord associations as inputs to array filters.
|
6
|
+
|
7
|
+
## Changed
|
8
|
+
|
9
|
+
- [#304][]: Improved the error message for object filters when the class does
|
10
|
+
not exist.
|
11
|
+
|
1
12
|
# [2.1.2][] (2015-09-03)
|
2
13
|
|
3
14
|
## Fixed
|
@@ -444,6 +455,7 @@ For help upgrading to version 2, please read [the announcement post][].
|
|
444
455
|
|
445
456
|
- Initial release.
|
446
457
|
|
458
|
+
[2.1.3]: https://github.com/orgsync/active_interaction/compare/v2.1.2...v2.1.3
|
447
459
|
[2.1.2]: https://github.com/orgsync/active_interaction/compare/v2.1.1...v2.1.2
|
448
460
|
[2.1.1]: https://github.com/orgsync/active_interaction/compare/v2.1.0...v2.1.1
|
449
461
|
[2.1.0]: https://github.com/orgsync/active_interaction/compare/v2.0.1...v2.1.0
|
@@ -583,5 +595,7 @@ For help upgrading to version 2, please read [the announcement post][].
|
|
583
595
|
[#295]: https://github.com/orgsync/active_interaction/issues/295
|
584
596
|
[#296]: https://github.com/orgsync/active_interaction/issues/296
|
585
597
|
[#298]: https://github.com/orgsync/active_interaction/issues/298
|
598
|
+
[#303]: https://github.com/orgsync/active_interaction/issues/303
|
599
|
+
[#304]: https://github.com/orgsync/active_interaction/issues/304
|
586
600
|
|
587
601
|
[the announcement post]: http://devblog.orgsync.com/2015/05/06/announcing-active-interaction-2/
|
data/lib/active_interaction.rb
CHANGED
@@ -59,10 +59,16 @@ module ActiveInteraction
|
|
59
59
|
# @return [Array<Class>]
|
60
60
|
def classes
|
61
61
|
result = [Array]
|
62
|
-
return result unless Object.const_defined?(:ActiveRecord)
|
63
|
-
return result unless ActiveRecord.const_defined?(:Relation)
|
64
62
|
|
65
|
-
|
63
|
+
%w[
|
64
|
+
ActiveRecord::Relation
|
65
|
+
ActiveRecord::Associations::CollectionProxy
|
66
|
+
].each do |name|
|
67
|
+
next unless (klass = name.safe_constantize)
|
68
|
+
result.push(klass)
|
69
|
+
end
|
70
|
+
|
71
|
+
result
|
66
72
|
end
|
67
73
|
|
68
74
|
# @param filter [Filter]
|
@@ -42,7 +42,7 @@ module ActiveInteraction
|
|
42
42
|
klass_name = options.fetch(:class, name).to_s.camelize
|
43
43
|
Object.const_get(klass_name)
|
44
44
|
rescue NameError
|
45
|
-
raise InvalidClassError, klass_name.inspect
|
45
|
+
raise InvalidClassError, "class #{klass_name.inspect} does not exist"
|
46
46
|
end
|
47
47
|
|
48
48
|
# @param value [Object]
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
+
module ActiveRecord
|
6
|
+
class Relation
|
7
|
+
end
|
8
|
+
|
9
|
+
module Associations
|
10
|
+
class CollectionProxy
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
ArrayInteraction = Class.new(TestInteraction) do
|
6
16
|
array :a do
|
7
17
|
array
|
@@ -14,6 +24,9 @@ end
|
|
14
24
|
describe ArrayInteraction do
|
15
25
|
include_context 'interactions'
|
16
26
|
it_behaves_like 'an interaction', :array, -> { [] }
|
27
|
+
it_behaves_like 'an interaction', :array, -> { ActiveRecord::Relation.new }
|
28
|
+
it_behaves_like 'an interaction', :array,
|
29
|
+
-> { ActiveRecord::Associations::CollectionProxy.new }
|
17
30
|
|
18
31
|
context 'with inputs[:a]' do
|
19
32
|
let(:a) { [[]] }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|