filter_form 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/filter_form/input_options/shared/with_associations.rb +2 -12
- data/lib/filter_form/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9adbbae8d73480ce1fce2c02e2f3167c0e677291
|
4
|
+
data.tar.gz: 5e95a42a620c695cf4b5f91899383f9db2e2e760
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37bcbbd277860589cf14bbf230ff745405ad1bd513281bf9d44fe852b4d33e1f088a7767318867a8acf0b2ad7629eded4bfc9a93eb5daae75752c99cd9eefbe
|
7
|
+
data.tar.gz: 33c0fdf413e10311e28f5b563d2a5373b59cfcce48f6710a425eb05cb59cc373aaeda992d4b3b4c8045474c62bbeab6abc658ba1fdb642a457638644ab4cf9e8
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ In your view file:
|
|
40
40
|
<%= f.filter_input :city # belongs_to %>
|
41
41
|
<%= f.filter_input :parents # has_many %>
|
42
42
|
<%= f.filter_input :amount # money %>
|
43
|
-
<%= f.filter_input :gender, as: :check_boxes, collection: [[:male, 'Male'], [:female, 'Female']]
|
43
|
+
<%= f.filter_input :gender, as: :check_boxes, collection: [[:male, 'Male'], [:female, 'Female']] # checkboxes %>
|
44
44
|
<%= f.button :submit %>
|
45
45
|
<% end %>
|
46
46
|
```
|
@@ -5,10 +5,8 @@ module FilterForm
|
|
5
5
|
def collection
|
6
6
|
if options[:collection]
|
7
7
|
options[:collection]
|
8
|
-
elsif
|
9
|
-
|
10
|
-
elsif collection?
|
11
|
-
attribute_name.to_s.camelize.singularize.constantize.all
|
8
|
+
elsif association
|
9
|
+
association.class_name.constantize.all
|
12
10
|
else
|
13
11
|
object.klass.uniq.pluck(attribute_name)
|
14
12
|
end
|
@@ -17,14 +15,6 @@ module FilterForm
|
|
17
15
|
def association
|
18
16
|
object.klass.reflections[attribute_name]
|
19
17
|
end
|
20
|
-
|
21
|
-
def belongs_to?
|
22
|
-
association && association.belongs_to?
|
23
|
-
end
|
24
|
-
|
25
|
-
def collection?
|
26
|
-
association && association.collection?
|
27
|
-
end
|
28
18
|
end
|
29
19
|
end
|
30
20
|
end
|
data/lib/filter_form/version.rb
CHANGED