Module: Merb::Helpers::Form

Defined in:
lib/merb-sexy-forms/form.rb

Instance Method Summary collapse

Instance Method Details

#sexy_form(attrs = {}, &blk) ⇒ Object



2
3
4
5
6
# File 'lib/merb-sexy-forms/form.rb', line 2

def sexy_form(attrs = {}, &blk)
  with_form_context_without_name(Merb::Helpers::SexyForm::Builder::Base) do
    current_form_context.form(attrs, &blk)
  end
end

#sexy_form_for(name, attrs = {}, &blk) ⇒ Object



8
9
10
11
12
# File 'lib/merb-sexy-forms/form.rb', line 8

def sexy_form_for(name, attrs = {}, &blk)
  with_form_context(name, Merb::Helpers::SexyForm::Builder::Base) do
    current_form_context.form(attrs, &blk)
  end
end

#with_form_context_without_name(builder) ⇒ Object



14
15
16
17
18
19
# File 'lib/merb-sexy-forms/form.rb', line 14

def with_form_context_without_name(builder)
  form_contexts.push((builder || self._default_builder).new(nil, nil, self))
  ret = yield
  form_contexts.pop
  ret
end