better_form 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module BetterForm
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -2,17 +2,17 @@ module BetterForm
2
2
  module ViewHelper
3
3
  def better_form_for(record_or_name_or_array, *args, &proc)
4
4
  options = args.extract_options!.reverse_merge(:builder => BetterForm::Builder)
5
- options[:class] = "#{options[:class]} better_form"
6
- @label_all = options[:label]
7
- @validate_all = options[:validate]
8
- form_for(record_or_name_or_array, *(args << options), &proc)
9
- end
10
5
 
11
- def better_fields_for(record_or_name_or_array, *args, &proc)
12
- options = args.extract_options!.reverse_merge(:builder => BetterForm::Builder)
13
- @label_all = options[:label]
14
- @validate_all = options[:validate]
15
- fields_for(record_or_name_or_array, *(args << options), &proc)
6
+ # Add the class 'better_form' to the list of classes for this form
7
+ options[:html] ||= {}
8
+ options[:html][:class] = "#{options[:html][:class]} better_form"
9
+
10
+ # Extract the better_form specific 'label' and 'validate_all' options
11
+ @label_all = options.delete(:label)
12
+ @validate_all = options.delete(:validate)
13
+
14
+ # Call the standard Rails form_for with our updated options
15
+ form_for(record_or_name_or_array, *(args << options), &proc)
16
16
  end
17
17
 
18
18
  def label_all?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: