title: Adding rails 3 form helpers to rails 2
body: <p>I would like to add the <a href="http://apidock.com/rails/v3.2.13/ActionView/Helpers/FormHelper/number_field" rel="nofollow">number_field</a> form helper that exists in rails 3 to my rails 2.3.15 app, but i'm having trouble extending the module.</p>
  
  <p>These are the methods I need from rails 3</p>
  
  <pre><code>class InstanceTag
      def to_number_field_tag(field_type, options = {})
          options = options.stringify_keys
          if range = options.delete("in") || options.delete("within")
            options.update("min" =&gt; range.min, "max" =&gt; range.max)
          end
          to_input_field_tag(field_type, options)
        end
  end
  
  def number_field(object_name, method, options = {})
          InstanceTag.new(object_name, method, self, options.delete(:object)).to_number_field_tag("number", options)
  end
  
  def number_field_tag(name, value = nil, options = {})
          options = options.stringify_keys
          options["type"] ||= "number"
          if range = options.delete("in") || options.delete("within")
            options.update("min" =&gt; range.min, "max" =&gt; range.max)
          end
          text_field_tag(name, value, options)
  end
  </code></pre>
  
  <p>I'm adding this to a module which i include in my application helper. The <code>to_number_field_tag</code> method is easy because i can just open the class and add the override. </p>
  
  <p>The FormHelper module methods I'm having trouble with because i can't quite figure out the ancestors chain and don't know how to scope my override. I don't know how to make it work basically.</p>