lib/voice_form/form_methods.rb
def field(field_name, options={}, &block)
      raise "A field requires a block" unless block_given?
      
      form_field = VoiceForm::FormField.new(field_name, options, self, &block)
      
      if self.is_a?(VoiceForm::Form)
        self.form_stack << form_field
      else
        unless self.respond_to?(field_name)
          self.class.class_eval do
            attr_accessor field_name
          end
        end
        form_field.run
      end
    end
# Can be used in a form or stand-alone in a component method
Can be used in a form or stand-alone in a component method
Can be used in a form or stand - alone in a component method
def field(field_name, options={}, &block)
      raise "A field requires a block" unless block_given?
      form_field = VoiceForm::FormField.new(field_name, options, self, &block)
      if self.is_a?(VoiceForm::Form)
        self.form_stack << form_field
      else
        unless self.respond_to?(field_name)
          self.class.class_eval do
            attr_accessor field_name
          end
        end
        form_field.run
      end
    end
def field ( field_name , options = { } , & block ) raise "A field requires a block" unless block_given? form_field = VoiceForm :: FormField . new ( field_name , options , self , & block ) if self . is_a? ( VoiceForm :: Form ) self . form_stack << form_field else unless self . respond_to? ( field_name ) self . class . class_eval do attr_accessor field_name end end form_field . run end end
Can be used in a form or stand-alone in a component method
Can be used in a form or stand - alone in a component method
field_name
options
block