effective_form_inputs 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/inputs/effective_select_input.rb +20 -0
- data/lib/effective_form_inputs/version.rb +1 -1
- 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: b1058617858590b805f30854d0afcda08271934e
|
4
|
+
data.tar.gz: 75034585c0a9f74ae5d7818c6742f68f85eb0e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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:
|
11
|
+
date: 2019-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|