filter_form 0.4.5 → 0.4.6

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: ba51d29e8704d894da94e7f88229feef17ed3bfc
4
- data.tar.gz: ddae4ac17d72019aaf3834b262dfbec3ac51c79e
3
+ metadata.gz: 99ecd45deccc48a229e6d8faff117fb5a87b22f4
4
+ data.tar.gz: 9f70f5ff1d832d6c5169e8a639e1250550ccf397
5
5
  SHA512:
6
- metadata.gz: 46f3b727047056bca25cfe8aac65e956e0d5075bdcda74ea17c895d3004e216e976837518d15835028ffc2eeb9109127f768ac84782ec9da9362778386cf10d3
7
- data.tar.gz: 93b278eb9cf40452f63cd08ca810ef9ec71ea656f414b25f33e659cf49f444edfc487f8b9e32542105e48271bb17bef3c02a77fef792602584be11f0909ec0c8
6
+ metadata.gz: 115cdd02a42840913def1a8f18dd274678cd7bef569b6a85b2d41ee2b93cbd686e30d773cfc71e78857e5ae1bb2eb98313ce5a0ac677771fac9b8c1a74368b88
7
+ data.tar.gz: f15b1c850a2d4e467d77546ce5b9ddd14d969959b37d4aa8d7ac158894db7c05fe136f0dfc517a3432a5cb7223363d7bd96069359dee811e5129c0f078c41063
@@ -52,7 +52,7 @@ module FilterForm
52
52
  end
53
53
 
54
54
  def input_name
55
- "q[#{ attribute_name }_#{ predicate }]"
55
+ "q[#{ input_attribute_name }_#{ predicate }]"
56
56
  end
57
57
 
58
58
  def input_value
@@ -60,7 +60,14 @@ module FilterForm
60
60
  end
61
61
 
62
62
  def object_condition
63
- object.base.conditions.select { |c| c.a.first.name == attribute_name.to_s }.first
63
+ object.base.conditions.select do |condition|
64
+ condition.a.first.name == input_attribute_name.to_s &&
65
+ condition.predicate.name == predicate.to_s
66
+ end.first
67
+ end
68
+
69
+ def input_attribute_name
70
+ attribute_name
64
71
  end
65
72
  end
66
73
  end
@@ -4,19 +4,11 @@ module FilterForm
4
4
  class BelongsTo < FilterForm::InputOptions::Select::Base
5
5
  private
6
6
 
7
- def object_condition
8
- object.base.conditions.select { |c| c.a.first.name == custom_attribute_name }.first
9
- end
10
-
11
7
  def collection
12
8
  options[:collection] || attribute_name.to_s.camelize.constantize.all
13
9
  end
14
10
 
15
- def input_name
16
- "q[#{ custom_attribute_name }_#{ predicate }]"
17
- end
18
-
19
- def custom_attribute_name
11
+ def input_attribute_name
20
12
  "#{ attribute_name }_id"
21
13
  end
22
14
  end
@@ -4,19 +4,11 @@ module FilterForm
4
4
  class Collection < FilterForm::InputOptions::Select::Base
5
5
  private
6
6
 
7
- def object_condition
8
- object.base.conditions.select { |c| c.a.first.name == custom_attribute_name }.first
9
- end
10
-
11
7
  def collection
12
8
  options[:collection] || attribute_name.to_s.camelize.singularize.constantize.all
13
9
  end
14
10
 
15
- def input_name
16
- "q[#{ custom_attribute_name }_#{ predicate }]"
17
- end
18
-
19
- def custom_attribute_name
11
+ def input_attribute_name
20
12
  "#{ attribute_name }_id"
21
13
  end
22
14
  end
@@ -10,8 +10,8 @@ module FilterForm
10
10
  end
11
11
  end
12
12
 
13
- def object_condition
14
- object.base.conditions.select { |c| c.a.first.name == "#{ attribute_name }_cents" }.first
13
+ def input_attribute_name
14
+ "#{ attribute_name }_cents"
15
15
  end
16
16
  end
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module FilterForm
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filter_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-21 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_form