Class: CaringForm::FormBuilder
- Inherits:
-
Object
- Object
- CaringForm::FormBuilder
show all
- Defined in:
- lib/caring_form/form_builder.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FormBuilder.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
32
33
34
35
|
# File 'lib/caring_form/form_builder.rb', line 32
def method_missing(meth, *args, &blk)
return super unless @builder.respond_to?(meth)
@builder.send(meth, *args, &blk)
end
|
Instance Method Details
#field(*names) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/caring_form/form_builder.rb', line 24
def field(*names)
options = names.
html_list = select_fields!(names, options).map do |field|
field.render(@form, @builder, options)
end
html_list.join("\n").html_safe
end
|
#fields(options = {}, &block) ⇒ Object
19
20
21
22
|
# File 'lib/caring_form/form_builder.rb', line 19
def fields(options = {}, &block)
tag = options.delete(:tag) || :ol
@builder.template.content_tag(tag, options, &block)
end
|
15
16
17
|
# File 'lib/caring_form/form_builder.rb', line 15
def metadata(options = {})
field(:all, options.merge(:filter_type => [:metadata, :dummy]))
end
|