Module: BetterForm::ViewHelper

Defined in:
lib/better_form/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#better_fields_for(record_or_name_or_array, *args, &proc) ⇒ Object



11
12
13
14
15
16
# File 'lib/better_form/view_helper.rb', line 11

def better_fields_for(record_or_name_or_array, *args, &proc)
  options = args.extract_options!.reverse_merge(:builder => BetterForm::Builder)
  @label_all = options[:label]
  @validate_all = options[:validate]
  fields_for(record_or_name_or_array, *(args << options), &proc)
end

#better_form_for(record_or_name_or_array, *args, &proc) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/better_form/view_helper.rb', line 3

def better_form_for(record_or_name_or_array, *args, &proc)
  options = args.extract_options!.reverse_merge(:builder => BetterForm::Builder)
  options[:class] = "#{options[:class]} better_form"
  @label_all = options[:label]
  @validate_all = options[:validate]
  form_for(record_or_name_or_array, *(args << options), &proc)
end

#label_all?Boolean



18
19
20
# File 'lib/better_form/view_helper.rb', line 18

def label_all?
  @label_all
end

#validate_all?Boolean



22
23
24
# File 'lib/better_form/view_helper.rb', line 22

def validate_all?
  @validate_all
end