<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,4 +7,7 @@ ActiveSupport::Dependencies.load_paths.unshift(File.join(File.dirname(__FILE__),
 ActiveRecord::Base.class_eval { include LiveValidations::ActiveRecordHooks }
 
 # Hook view helpers
-ActionView::Base.class_eval { include LiveValidations::ViewHelpers }
\ No newline at end of file
+ActionView::Base.class_eval { include LiveValidations::ViewHelpers }
+
+## Hook into the default form builder
+ActionView::Helpers::FormBuilder.class_eval { include LiveValidations::FormBuilder }
\ No newline at end of file</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -65,7 +65,6 @@ module LiveValidations
     end
 
     def handle_form_for_options(options)
-      options.merge!(:builder =&gt; LiveValidations::FormBuilder)
       self.class.form_for_options_proc.call(options) if self.class.form_for_options_proc
     end
     </diff>
      <filename>lib/live_validations/adapter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,52 +1,59 @@
 module LiveValidations
-  class FormBuilder &lt; ActionView::Helpers::FormBuilder
-    # Where the html options are foo_field(:fieldname, :html =&gt; {})
-    helpers_with_one_option_hash = field_helpers + %w(hidden_field fields_for) - %w(label)
-    
-    # Where the HTML options are foo_field(:fieldname, {:options =&gt; 'here'}, {:html_options =&gt; 'here'})
-    helpers_with_two_option_hashes = %w(date_select datetime_select time_select) +
-    %w(collection_select select country_select time_zone_select)
-    
-
-    helpers_with_one_option_hash.each do |helper|
-      define_method(helper) do |attribute, *args|
-        tag_attributes = @template.adapter_instance[:tag_attributes] &amp;&amp; @template.adapter_instance[:tag_attributes][attribute]
+  module FormBuilder
+    def self.included(base)
+      base.instance_eval {
+        # Where the html options are foo_field(:fieldname, :html =&gt; {})
+        helpers_with_one_option_hash = field_helpers - %w(label apply_form_for_options! fields_for)
         
-        if tag_attributes
-          options = args.extract_options!
-          options.merge!(tag_attributes)
-          super(attribute, *(args &lt;&lt; options))
-        else
-          super
-        end
-      end
-    end
-    
-    helpers_with_two_option_hashes.each do |helper|
-      define_method(helper) do |attribute, *args|
-        tag_attributes = @template.adapter_instance[:tag_attributes] &amp;&amp; @template.adapter_instance[:tag_attributes][attribute]
+        # Where the HTML options are foo_field(:fieldname, {:options =&gt; 'here'}, {:html_options =&gt; 'here'})
+        helpers_with_two_option_hashes = %w(date_select datetime_select time_select) +
+        %w(collection_select select time_zone_select)
         
-        if tag_attributes
-          # We have both options and html_options
-          if args[-1].is_a?(Hash) &amp;&amp; args[-2].is_a?(Hash)
-            html_options = args.pop
-            options = args.pop
-            
-            html_options.merge!(tag_attributes)
-            args &lt;&lt; options
-            args &lt;&lt; html_options
-            super(attribute, *args)
-          # No html_options was specified
-          else
-            html_options = tag_attributes
-            args &lt;&lt; {} unless args[-1].is_a?(Hash)
-            args &lt;&lt; html_options
-            super(attribute, *args)
+        helpers_with_one_option_hash.each do |helper|
+          define_method(&quot;#{helper}_with_live_validations&quot;) do |attribute, *args|
+            tag_attributes = @template.adapter_instance &amp;&amp; @template.adapter_instance[:tag_attributes] &amp;&amp; @template.adapter_instance[:tag_attributes][attribute]
+
+            if tag_attributes
+              options = args.extract_options!
+              options.merge!(tag_attributes)
+              __send__(&quot;#{helper}_without_live_validations&quot;, attribute, *(args &lt;&lt; options))
+            else
+              __send__(&quot;#{helper}_without_live_validations&quot;, attribute, *args)
+            end
           end
-        else
-          super
+
+          alias_method_chain helper, &quot;live_validations&quot;
+        end
+
+        helpers_with_two_option_hashes.each do |helper|
+          define_method(&quot;#{helper}_with_live_validations&quot;) do |attribute, *args|
+            tag_attributes = @template.adapter_instance &amp;&amp; @template.adapter_instance[:tag_attributes] &amp;&amp; @template.adapter_instance[:tag_attributes][attribute]
+
+            if tag_attributes
+              # We have both options and html_options
+              if args[-1].is_a?(Hash) &amp;&amp; args[-2].is_a?(Hash)
+                html_options = args.pop
+                options = args.pop
+
+                html_options.merge!(tag_attributes)
+                args &lt;&lt; options
+                args &lt;&lt; html_options
+                __send__(&quot;#{helper}_without_live_validations&quot;, *args)
+              # No html_options was specified
+              else
+                html_options = tag_attributes
+                args &lt;&lt; {} unless args[-1].is_a?(Hash)
+                args &lt;&lt; html_options
+                __send__(&quot;#{helper}_without_live_validations&quot;, attribute, *args)
+              end
+            else
+              __send__(&quot;#{helper}_without_live_validations&quot;, attribute, *args)
+            end
+          end
+
+          alias_method_chain helper, &quot;live_validations&quot;
         end
-      end
+      }
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/live_validations/form_builder.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>86a4c9df37b5716b33a6bd65377e4b59621c6db1</id>
    </parent>
  </parents>
  <author>
    <name>August Lilleaas</name>
    <email>augustlilleaas@gmail.com</email>
  </author>
  <url>http://github.com/augustl/live-validations/commit/a544e26c1111f0806aab56de910ea72c328c7e96</url>
  <id>a544e26c1111f0806aab56de910ea72c328c7e96</id>
  <committed-date>2009-03-09T12:31:07-07:00</committed-date>
  <authored-date>2009-03-09T12:31:07-07:00</authored-date>
  <message>Injecting the form builder code into the built-in formbuilder instead of creating a separate one. This is so that custom form builders that subclasses the built-in one are able to use live validations.</message>
  <tree>052b1b6185f59f6ea41054690f40baa5c4e13665</tree>
  <committer>
    <name>August Lilleaas</name>
    <email>augustlilleaas@gmail.com</email>
  </committer>
</commit>
