active_interaction 1.3.1 → 1.4.0

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
  SHA1:
3
- metadata.gz: 17c5f3f9d7839f69402b77687939e96072fb1d90
4
- data.tar.gz: 825810914132a17a96ba6aabee8df1f9c86f5dc5
3
+ metadata.gz: a00db578594483e7fe73f362bee7f4d0ec7aebcf
4
+ data.tar.gz: d666371074ab0a681edaf845663fc86ecb178b0f
5
5
  SHA512:
6
- metadata.gz: e53ecbca6b68702b4fec258879193e776d82cc8d38ff55c9e8c0296ec8858a2d934a782f5f6ac89cbe21c07ad1e93315dd8069d51011e7da0afcc22151fd6f2f
7
- data.tar.gz: b36c35ef30dad6c6d1c63af024a50c18b4a5ef474158a29a4c6cb7984338ae65e429ad968bffcc427bc608d27cde23b06802c55fb9ab57e38ca4999a051336a2
6
+ metadata.gz: 87bc01ad6c2222511e233f5b67ee0a1d5b0778a4e1b64342c9f4637cce317a7e0e204c8a3639ef20cadc057265e130b68fe40b9ad006e36b545e72c9c7aacbdf
7
+ data.tar.gz: d7d04bb2bbe7be1737427c7679712bc3ec3da22d26dc31ad2080930e4c52178118dffb44a5f3750eb789d0981056154c0b5a4ccc4a68141f2fa0e6c22f6ba81e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # [Master][]
2
2
 
3
+ # [1.4.0][] (2014-12-10)
4
+
5
+ ## Changed
6
+
7
+ - [#239][]: Accept `ActiveRecord::Relation` objects as `array` inputs.
8
+
3
9
  # [1.3.1][] (2014-12-10)
4
10
 
5
11
  ## Fixed
@@ -354,7 +360,8 @@
354
360
 
355
361
  - Initial release.
356
362
 
357
- [master]: https://github.com/orgsync/active_interaction/compare/v1.3.1...master
363
+ [master]: https://github.com/orgsync/active_interaction/compare/v1.4.0...master
364
+ [1.4.0]: https://github.com/orgsync/active_interaction/compare/v1.3.1...v1.4.0
358
365
  [1.3.1]: https://github.com/orgsync/active_interaction/compare/v1.3.0...v1.3.1
359
366
  [1.3.0]: https://github.com/orgsync/active_interaction/compare/v1.2.5...v1.3.0
360
367
  [1.2.5]: https://github.com/orgsync/active_interaction/compare/v1.2.4...v1.2.5
@@ -466,3 +473,4 @@
466
473
  [#207]: https://github.com/orgsync/active_interaction/issues/207
467
474
  [#224]: https://github.com/orgsync/active_interaction/issues/224
468
475
  [#235]: https://github.com/orgsync/active_interaction/issues/235
476
+ [#239]: https://github.com/orgsync/active_interaction/issues/239
data/README.md CHANGED
@@ -25,7 +25,7 @@ This project uses [semantic versioning][13].
25
25
  Add it to your Gemfile:
26
26
 
27
27
  ``` ruby
28
- gem 'active_interaction', '~> 1.3'
28
+ gem 'active_interaction', '~> 1.4'
29
29
  ```
30
30
 
31
31
  And then execute:
@@ -50,5 +50,5 @@ I18n.load_path.unshift(Dir[File.expand_path(
50
50
  #
51
51
  # @since 1.0.0
52
52
  #
53
- # @version 1.3.1
53
+ # @version 1.4.0
54
54
  module ActiveInteraction end
@@ -1,5 +1,10 @@
1
1
  # coding: utf-8
2
2
 
3
+ begin
4
+ require 'active_record'
5
+ rescue LoadError
6
+ end
7
+
3
8
  module ActiveInteraction
4
9
  class Base
5
10
  # @!method self.array(*attributes, options = {}, &block)
@@ -29,7 +34,7 @@ module ActiveInteraction
29
34
 
30
35
  def cast(value)
31
36
  case value
32
- when Array
37
+ when *classes
33
38
  return value if filters.empty?
34
39
 
35
40
  filter = filters.values.first
@@ -51,6 +56,17 @@ module ActiveInteraction
51
56
 
52
57
  private
53
58
 
59
+ # @return [Array<Class>]
60
+ def classes
61
+ result = [Array]
62
+
63
+ if ActiveRecord.const_defined?(:Relation)
64
+ result.push(ActiveRecord::Relation)
65
+ end
66
+
67
+ result
68
+ end
69
+
54
70
  # @param filter [Filter]
55
71
  # @param names [Array<Symbol>]
56
72
  #
@@ -5,5 +5,5 @@ module ActiveInteraction
5
5
  # The version number.
6
6
  #
7
7
  # @return [Gem::Version]
8
- VERSION = Gem::Version.new('1.3.1')
8
+ VERSION = Gem::Version.new('1.4.0')
9
9
  end
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: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne