<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -98,7 +98,7 @@ module LiveValidations
         
         %{
           #{custom_rules(a)}
-          $('##{dom_id}').validate(#{validator_options.to_json})
+          $('##{dom_id}').validate(#{to_json_with_function_awareness(validator_options)})
         }
       end
       
@@ -114,6 +114,19 @@ module LiveValidations
       def self.custom_rules(a)
         a[:declarations].join(&quot;\n&quot;)
       end
+
+      def self.to_json_with_function_awareness(validator_options)
+        functions = {}
+        function_strings = validator_options.select { |k, v| v.is_a?(String) &amp;&amp; v.starts_with?('function') }
+        function_strings.each_with_index do |function_string, i|
+          function_key = &quot;%function_#{i + 1}%&quot;
+          functions[function_key] = function_string.last
+          validator_options[function_string.first] = function_key
+        end
+        functions.inject(validator_options.to_json) do |json, function|
+          json.gsub(/&quot;#{function.first}&quot;/i, function.last)
+        end
+      end
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/live_validations/adapters/jquery_validations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,6 +42,14 @@ class JqueryValidationsControllerOutputTest &lt; Test::Unit::TestCase
     assert rendered_view.include?(expected_json.to_json)
   end
   
+  def test_validator_options_with_function
+    Post.validates_presence_of :title
+    LiveValidations.use LiveValidations::Adapters::JqueryValidations, :validator_settings =&gt; {&quot;errorPlacement&quot; =&gt; &quot;function(error, element) { error.appendTo(element.prev('label')); }&quot;}
+
+    render
+
+    assert rendered_view.include?(%[&quot;errorPlacement&quot;:function(error, element) { error.appendTo(element.prev('label')); }])
+  end
  
   def test_validator_options
     Post.validates_presence_of :title</diff>
      <filename>test/jquery_validations_controller_output_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ca278c4762ec5de8e95713a313522abbdf67345a</id>
    </parent>
  </parents>
  <author>
    <name>manuelmeurer</name>
    <email>manuel.meurer@gmail.com</email>
  </author>
  <url>http://github.com/augustl/live-validations/commit/e6904d149977c991898d416cfd7b5c29f4ada0ba</url>
  <id>e6904d149977c991898d416cfd7b5c29f4ada0ba</id>
  <committed-date>2009-10-05T05:01:05-07:00</committed-date>
  <authored-date>2009-10-05T05:01:05-07:00</authored-date>
  <message>Make jQuery validations adapter work nice with functions as arguments</message>
  <tree>a8b0ff48c7a85f436bb466d0bf10e596be6e08ba</tree>
  <committer>
    <name>manuelmeurer</name>
    <email>manuel.meurer@gmail.com</email>
  </committer>
</commit>
