Class: Formtastic::FormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Formtastic::FormBuilder
- Includes:
- Helpers::ActionHelper, Helpers::ActionsHelper, Helpers::ErrorsHelper, Helpers::InputHelper, Helpers::InputsHelper
- Defined in:
- lib/formtastic/form_builder.rb
Constant Summary
Constant Summary
Constants included from Helpers::ErrorsHelper
Helpers::ErrorsHelper::INLINE_ERROR_TYPES
Constants included from Helpers::InputsHelper
Helpers::InputsHelper::SKIPPED_COLUMNS
Instance Attribute Summary (collapse)
-
- (Object) auto_index
readonly
Returns the value of attribute auto_index.
-
- (Object) template
readonly
Returns the value of attribute template.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (FormBuilder) initialize(object_name, object, template, options, block = nil)
constructor
A new instance of FormBuilder.
-
- (Object) semantic_fields_for(record_or_name_or_array, *args, &block)
This is a wrapper around Rails'
ActionView::Helpers::FormBuilder#fields_for, originally provided to ensure that the:builderfromsemantic_form_forwas passed down into the nestedfields_for.
Methods included from Helpers::ErrorsHelper
Methods included from LocalizedString
Methods included from Helpers::ActionsHelper
Methods included from Helpers::ActionHelper
Methods included from Helpers::InputsHelper
Methods included from Helpers::InputHelper
Constructor Details
- (FormBuilder) initialize(object_name, object, template, options, block = nil)
A new instance of FormBuilder
84 85 86 87 88 89 |
# File 'lib/formtastic/form_builder.rb', line 84 def initialize(object_name, object, template, , block=nil) super if respond_to?('multipart=') && .is_a?(Hash) && [:html] self.multipart = [:html][:multipart] end end |
Instance Attribute Details
- (Object) auto_index (readonly)
Returns the value of attribute auto_index
37 38 39 |
# File 'lib/formtastic/form_builder.rb', line 37 def auto_index @auto_index end |
- (Object) template (readonly)
Returns the value of attribute template
35 36 37 |
# File 'lib/formtastic/form_builder.rb', line 35 def template @template end |
Class Method Details
+ (Object) configure(name, value = nil)
4 5 6 7 |
# File 'lib/formtastic/form_builder.rb', line 4 def self.configure(name, value = nil) class_attribute(name) self.send(:#{name}=", value) end |
Instance Method Details
- (Object) semantic_fields_for(record_or_name_or_array, *args, &block)
is there a way to test the params structure of the Rails helper we wrap to ensure forward compatibility?
This is a wrapper around Rails' ActionView::Helpers::FormBuilder#fields_for, originally
provided to ensure that the :builder from semantic_form_for was passed down into
the nested fields_for. Rails 3 no longer requires us to do this, so this method is
provided purely for backwards compatibility and DSL consistency.
When constructing a fields_for form fragment outside of semantic_form_for, please use
Formtastic::Helpers::FormHelper#semantic_fields_for.
75 76 77 78 79 80 81 82 |
# File 'lib/formtastic/form_builder.rb', line 75 def semantic_fields_for(record_or_name_or_array, *args, &block) # Add a :parent_builder to the args so that nested translations can be possible in Rails 3 = args. [:parent_builder] ||= self # Wrap the Rails helper fields_for(record_or_name_or_array, *(args << ), &block) end |