Class: Dao::Form::Builder

Inherits:
Dao::Form show all
Defined in:
lib/dao/form.rb

Overview

builder stuff for compatibity with rails’ form_for()

Instance Attribute Summary

Attributes inherited from Dao::Form

#object, #scope, #unscoped

Class Method Summary collapse

Methods inherited from Dao::Form

#attr_for, #capture, #class_for, #data_attr_for, #error_for, #errors_on, #errors_on?, #escape_html, for, #id_for, #initialize, key_for, #key_for, name_for, #name_for, #options_for, prefix_for, #slug_for, #titleize, #value_for

Methods included from Elements

#button, #checkbox, #element, #form, #hidden, #input, #label, #radio_button, #reset, #select, #submit, #textarea, #upload

Constructor Details

This class inherits a constructor from Dao::Form

Class Method Details

.new(object_name, object, view, options, block) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dao/form.rb', line 15

def Builder.new(object_name, object, view, options, block)
  if object.respond_to?(:form)

    html = options[:html] || {}
    html[:class] ||= 'dao'
    unless html[:class] =~ /(\s|\A)dao(\Z|\s)/o
      html[:class] << ' dao dao-form'
    end

    object.form
  else
    raise ArgumentError, object.class.name
  end
end