simple_form_extension 1.2.4 → 1.2.5

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: 58c0b2f6d645cc957beb0490999f19aa2fe2b311
4
- data.tar.gz: 0a4babbd115696a168f07a2b86477de745e8c9cb
3
+ metadata.gz: d48e3e9306c83e88a05bc7f078bc5ed8ffb85c9d
4
+ data.tar.gz: 8ad7f2ee5f6b4609ef3c064443fd9af0b2cc8c79
5
5
  SHA512:
6
- metadata.gz: 525267f1f89d731e5d8f54667aa980c516f376d76bc02237b4f213ee8993738e78f9da9801e0371d5660eb3f206aad376a71f909ba328cd1571b681fdc6aac8d
7
- data.tar.gz: ddcf4d10d63dbd502e1ad5a7fb29c4a8f80786b04df719c2d0d17dc0321487e2f4cda687a3861028a8621ebf421a3e876bc74ffefefafa818b92f34a9a4b4f59
6
+ metadata.gz: 1913c9615669978608dd666dff35c6d75630e9649681d88c9ea2bfdb74f65f3b898b291aaf0aa12e58e2853aabe949a676a3ff1ea466d34b241619e294040cfb
7
+ data.tar.gz: 4cbbec88be4760a76644b1d5a85cb3565162ed4a8d399565731dd2dd4a652677dfd91b9035ced20928f959c6be96baa1449b96921b2c5d119b7e53605cfeb9cd
@@ -13,6 +13,8 @@ module SimpleFormExtension
13
13
  # :'preload' => preload,
14
14
  #
15
15
  def input(wrapper_options = {})
16
+ @attribute_name = reflection.foreign_key if relation?
17
+ puts "RELATION ? => #{ relation? } // #{ reflection.foreign_key }"
16
18
  input_html_options[:data] ||= {}
17
19
 
18
20
  input_html_options[:data].merge!(
@@ -98,6 +100,14 @@ module SimpleFormExtension
98
100
  def name_for(option)
99
101
  option.try(:name) || options.try(:title) || option.to_s
100
102
  end
103
+
104
+ def relation?
105
+ !!reflection
106
+ end
107
+
108
+ def reflection
109
+ @reflection ||= object.class.reflect_on_association(attribute_name)
110
+ end
101
111
  end
102
112
  end
103
113
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Vasseur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.2.2
169
+ rubygems_version: 2.4.4
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: A simple extention for simple_form with, colorpiker, icon, fileupload, image