effective_form_inputs 1.2.2 → 1.2.3

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: b795af9a9786ae9ee1efdf00a31b12d3a1e3b446
4
- data.tar.gz: 87ea3406808b96fd668d717c8080d85d5f997ec3
3
+ metadata.gz: b03aaedcf0c4922442f4beeaabd3c487efc79c86
4
+ data.tar.gz: 0328e687027e6ad11b2d20d2ff94ef0e7044110d
5
5
  SHA512:
6
- metadata.gz: 5856c9df7f3c13e18d602f55d16e1e0ee2e25c3e69a117ed6c1fef89ac26813ad6ceb1000b03105b2e29689b15c09e913fbfb16ac06bc7506fb5354aa3fe4cfc
7
- data.tar.gz: 6e2b93e14072ebbbf8564bc8c20fcce731bd830fc687e980e8351968ad109e2213a4235508bad34b3ca2e669d48b950b25c8377560aff5f9ead404d374138825
6
+ metadata.gz: dead58136fd0b16bba56980e43202e581760281632f0bf333571e03e9b182626535748a1427d51afcb6f5e1b729b07ca1e8be935b58a24d93e7ca1116f3bc4eb
7
+ data.tar.gz: 71f0110ebeab045f6b7cad48647052b544b3a811c4bb4ebb6bf174ded67dc6ded60f277df5ac28178931c5ab579a761077ea5d5d0880906b5649e18a44650946
@@ -56,6 +56,18 @@ module Inputs
56
56
  options[:option_key_method] = :id if options[:option_key_method] == default_options[:option_key_method]
57
57
  end
58
58
 
59
+ if grouped && !options[:polymorphic]
60
+ if collection[0][1].kind_of?(ActiveRecord::Relation)
61
+ options[:option_value_method] = :to_s if options[:option_value_method] == default_options[:option_value_method]
62
+ options[:option_key_method] = :id if options[:option_key_method] == default_options[:option_key_method]
63
+ end
64
+
65
+ if collection[0][1].kind_of?(Array) && !collection[0][1][0].kind_of?(Array)
66
+ options[:option_value_method] = :to_s if options[:option_value_method] == default_options[:option_value_method]
67
+ options[:option_key_method] = :to_s if options[:option_key_method] == default_options[:option_key_method]
68
+ end
69
+ end
70
+
59
71
  if grouped
60
72
  collection.each_with_index do |(name, group), index|
61
73
  collection[index][1] = group.respond_to?(:call) ? group.call : group.to_a
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '1.2.2'.freeze
2
+ VERSION = '1.2.3'.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.2
4
+ version: 1.2.3
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-04-09 00:00:00.000000000 Z
11
+ date: 2018-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails