effective_form_inputs 1.2.7 → 1.2.8

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: 73018ef84c08c044734ce1588e09044e9b7879b5
4
- data.tar.gz: c304c9be743476829d43660d857c53902840001a
3
+ metadata.gz: b1058617858590b805f30854d0afcda08271934e
4
+ data.tar.gz: 75034585c0a9f74ae5d7818c6742f68f85eb0e2a
5
5
  SHA512:
6
- metadata.gz: 1e44b1ee96ea3b93918b28ced09b3bd7bf8c8b96a489d93195ef646c7332f5ac5f965b8ce860ee1f2738bdeac702ca67e24e65f1fd38aa4d1b5097ee8ee5abb7
7
- data.tar.gz: ab87a091e9b9ce2405b05b2d8d0170a795830810c72e60cd924047ce544fdeaad37a271cd0138f59685aeaca45bd0395b8393cc0d9976d9e23c0f0d12de92283
6
+ metadata.gz: bcdd07ec86ed2174b07fc61f74305ec43ab102fbc8ba33170ceea929a5799feb5b07355cc9d446fbbc5c6f3b2491c39fa6db12d2f54c3097f819779af10149d4
7
+ data.tar.gz: 752fe22d30b2e1fbd4d76ace82b261a60003224922ca60d42d9e6e79357244e4c3b52bd9f55140e2af3cf9800509823b86151ef857dc5930fb77c31b151172be
@@ -13,6 +13,26 @@ if defined?(SimpleForm)
13
13
 
14
14
  Inputs::EffectiveSelect::Input.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
15
15
  end
16
+
17
+ # Apply ActsAsArchived behavior.
18
+ def collection
19
+ @collection ||= begin
20
+ collection = translate(options.delete(:collection)) || self.class.boolean_collection
21
+ collection.respond_to?(:call) ? collection.call : collection.to_a
22
+ end
23
+ end
24
+
25
+ def translate(collection)
26
+ return collection unless object.respond_to?(:new_record?)
27
+ return collection unless collection.respond_to?(:klass) && collection.klass.respond_to?(:acts_as_archived?)
28
+
29
+ if object.new_record?
30
+ collection.unarchived
31
+ else
32
+ collection.unarchived.or(collection.archived.where(collection.klass.primary_key => object.send(attribute_name)))
33
+ end
34
+ end
35
+
16
36
  end
17
37
 
18
38
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '1.2.7'.freeze
2
+ VERSION = '1.2.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_form_inputs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-13 00:00:00.000000000 Z
11
+ date: 2019-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails