simple_form-dropdown_select 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01d9cd42210ca45eba7c87399c6bd5a5d51a3e88
|
4
|
+
data.tar.gz: 3cd78dcac4b48b62e7b761898882f44f70929972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 217e0c8f276ae3583b8291dc1f746771ae38747813d7a352f524b5f0ab5d5c31cdd12bd5c43c1751dd3e9adb10360ce918642f871d1e3661e69dee03897c0abd
|
7
|
+
data.tar.gz: a033c6f30a12ce85b32731273ae8553acf41e43e85fab91ec284a7e458036b7c0cb57f1eaa2a2a90ae2e5b31f25015cae03c8c62aa300242a0351ba0067b2f46
|
@@ -3,8 +3,16 @@ class DropdownSelectInput < SimpleForm::Inputs::CollectionInput
|
|
3
3
|
include ActionView::Helpers::TagHelper
|
4
4
|
include ActionView::Context
|
5
5
|
|
6
|
+
def current_value
|
7
|
+
input_html_options[:value] || object.try(:send, attribute_name)
|
8
|
+
end
|
9
|
+
|
6
10
|
def selected_option
|
7
|
-
|
11
|
+
if current_value
|
12
|
+
collection.find { |x| x[1] == current_value }
|
13
|
+
else
|
14
|
+
collection.first
|
15
|
+
end
|
8
16
|
end
|
9
17
|
|
10
18
|
def input(wrapper_options = nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form-dropdown_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|