Module: LazyForm::Helper
- Defined in:
- lib/lazy_form.rb,
lib/lazy_form/sinatra.rb
Instance Method Summary collapse
Instance Method Details
#form_for(object, url, attributes = {}, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/lazy_form.rb', line 10 def form_for(object, url, attributes = {}, &block) attributes[:action] = url attributes[:method] ||= 'POST' attrs = attributes.collect { |k, v| "#{k}=\"#{v}\"" } attrs.unshift 'form' outvar << "<#{attrs.reject(&:empty?).join ' '}>\n" form_builder = Builder.new object block.call form_builder outvar << "</form>\n" end |
#outvar ⇒ Object
6 7 8 |
# File 'lib/lazy_form.rb', line 6 def outvar @_output end |