Module: NestedForm::ViewHelper

Defined in:
lib/nested_form/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#after_nested_form(association, &block) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/nested_form/view_helper.rb', line 24

def after_nested_form(association, &block)
  @associations ||= []
  @after_nested_form_callbacks ||= []
  unless @associations.include?(association)
    @associations << association
    @after_nested_form_callbacks << block
  end
end

#nested_form_for(*args, &block) ⇒ Object



5
6
7
8
# File 'lib/nested_form/view_helper.rb', line 5

def nested_form_for(*args, &block)
  options = args.extract_options!.reverse_merge(:builder => NestedForm::Builder)
  form_for(*(args << options), &block) << after_nested_form_callbacks
end

#semantic_nested_form_for(*args, &block) ⇒ Object



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

def semantic_nested_form_for(*args, &block)
  options = args.extract_options!.reverse_merge(:builder => NestedForm::FormtasticBuilder)
  semantic_form_for(*(args << options), &block) << after_nested_form_callbacks
end

#simple_nested_form_for(*args, &block) ⇒ Object



11
12
13
14
# File 'lib/nested_form/view_helper.rb', line 11

def simple_nested_form_for(*args, &block)
  options = args.extract_options!.reverse_merge(:builder => NestedForm::SimpleBuilder)
  simple_form_for(*(args << options), &block) << after_nested_form_callbacks
end