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
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lazy_form.rb', line 9 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
5 6 7 |
# File 'lib/lazy_form.rb', line 5 def outvar @_output end |