Module: NestedForm::ViewHelper

Defined in:
lib/nested_form/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#after_nested_form(association, &block) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/nested_form/view_helper.rb', line 39

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
9
10
# 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)) do |f|
    capture(f, &block).to_s << after_nested_form_callbacks
  end
end

#semantic_bootstrap_nested_form_for(*args, &block) ⇒ Object



31
32
33
34
35
36
# File 'lib/nested_form/view_helper.rb', line 31

def semantic_bootstrap_nested_form_for(*args, &block)
  options = args.extract_options!.reverse_merge(:builder => NestedForm::FormtasticBootstrapBuilder)
  semantic_form_for(*(args << options)) do |f|
    capture(f, &block).to_s << after_nested_form_callbacks
  end
end

#semantic_nested_form_for(*args, &block) ⇒ Object



22
23
24
25
26
27
# File 'lib/nested_form/view_helper.rb', line 22

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

#simple_nested_form_for(*args, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/nested_form/view_helper.rb', line 13

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