dynamic_fieldsets 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.11
2
+
3
+ * Fixed an issue where a model using multiple dynamic fieldsets would never pass validations
4
+ * Improved the show renderer helper to display field option names instead of ids for fields that use field options
5
+
1
6
  == 0.0.10
2
7
 
3
8
  * Fixed an issue where models using Dynamic Fieldsets could not be created without the fieldset information
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.11
@@ -16,6 +16,10 @@ module DynamicFieldsetsHelper
16
16
 
17
17
 
18
18
  # Builds HTML for the provided field for a show page.
19
+ #
20
+ # The code to get the names for fields using field options (select, multiple select, checkbox, and radio)
21
+ # is not optimized to minimize hitting the database
22
+ #
19
23
  # @param [FieldsetAssociator] fsa parent FieldsetAssociator
20
24
  # @param [FieldsetChild] fieldset_child The FieldsetChild to render
21
25
  # @param [Array] values Saved values for the field
@@ -29,12 +33,14 @@ module DynamicFieldsetsHelper
29
33
  if values
30
34
  if field.field_type == "multiple_select" || field.field_type == "checkbox"
31
35
  values.each do |value|
32
- lines.push value.to_s + "<br />"
36
+ lines.push field.options.select { |opt| opt.id = value }.first.name + "<br />"
33
37
  end
34
38
  elsif field.field_type == "select" || field.field_type == "radio"
35
- lines.push values.to_s
39
+ lines.push field.options.select { |opt| opt.id = values }.first.name
40
+ # this might be easier on the db
41
+ # lines.push DynamicFieldsets::FieldOption.find(values).name
36
42
  else
37
- lines.push values
43
+ lines.push values + "wow3"
38
44
  end
39
45
  else
40
46
  lines.push "No answer given"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dynamic_fieldsets}
8
- s.version = "0.0.10"
8
+ s.version = "0.0.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Jeremiah Hemphill}, %q{Ethan Pemble}, %q{John Carter}]
@@ -61,7 +61,8 @@ module DynamicFieldsets
61
61
  fsa = self.fieldset_associator(key)
62
62
  fsa_tag_id = "fsa-" + fsa.id.to_s
63
63
 
64
- if !self.dynamic_fieldset_values.nil? && self.dynamic_fieldset_values.has_key?(fsa_tag_id)
64
+ # check if the values are set, if it matches the current fsa, and if it matches the current fieldset
65
+ if !self.dynamic_fieldset_values.nil? && self.dynamic_fieldset_values.has_key?(fsa_tag_id) && self.dynamic_fieldset_values[fsa_tag_id][:fieldset_model_name] == key
65
66
  run_fieldset_child_validations!(fsa.id, fsa.fieldset)
66
67
  end
67
68
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynamic_fieldsets
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeremiah Hemphill
@@ -351,7 +351,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
351
351
  requirements:
352
352
  - - ">="
353
353
  - !ruby/object:Gem::Version
354
- hash: -1922917679847302797
354
+ hash: -4483893965700414166
355
355
  segments:
356
356
  - 0
357
357
  version: "0"