Class: Tungsten::FormForHelper::TungstenFormBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/tungsten/form_for_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(template, values, errors) ⇒ TungstenFormBuilder

Returns a new instance of TungstenFormBuilder.



4
5
6
7
8
# File 'app/helpers/tungsten/form_for_helper.rb', line 4

def initialize(template, values, errors)
  @template = template
  @values = values
  @errors = errors
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, field_name, options = {}, &block) ⇒ Object



10
11
12
13
14
15
# File 'app/helpers/tungsten/form_for_helper.rb', line 10

def method_missing(method, field_name, options = {}, &block)
  @template.send(method, field_name, options.merge({
    value: @values[field_name],
    errors: @errors[field_name]
  }.compact), &block)
end