<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -31,6 +31,21 @@ module ActiveModel
       # * &lt;tt&gt;:unless&lt;/tt&gt; - Specifies a method, proc or string to call to determine if the validation should
       #   not occur (e.g. &lt;tt&gt;:unless =&gt; :skip_validation&lt;/tt&gt;, or &lt;tt&gt;:unless =&gt; Proc.new { |user| user.signup_step &lt;= 2 }&lt;/tt&gt;).  The
       #   method, proc or string should return or evaluate to a true or false value.
+      #
+      # The following checks can also be supplied with a proc or a symbol which corresponds to a method:
+      # * &lt;tt&gt;:greater_than&lt;/tt&gt;
+      # * &lt;tt&gt;:greater_than_or_equal_to&lt;/tt&gt;
+      # * &lt;tt&gt;:equal_to&lt;/tt&gt;
+      # * &lt;tt&gt;:less_than&lt;/tt&gt;
+      # * &lt;tt&gt;:less_than_or_equal_to&lt;/tt&gt;
+      #
+      #   class Person &lt; ActiveRecord::Base
+      #     validates_numericality_of :width, :less_than =&gt; Proc.new { |person| person.height }
+      #     validates_numericality_of :width, :greater_than =&gt; :minimum_weight
+      #   end
+      #
+      #
+
       def validates_numericality_of(*attr_names)
         configuration = { :only_integer =&gt; false, :allow_nil =&gt; false }
         configuration.update(attr_names.extract_options!)
@@ -38,7 +53,8 @@ module ActiveModel
         numericality_options = ALL_NUMERICALITY_CHECKS.keys &amp; configuration.keys
 
         (numericality_options - [ :odd, :even ]).each do |option|
-          raise ArgumentError, &quot;:#{option} must be a number&quot; unless configuration[option].is_a?(Numeric)
+          value = configuration[option]
+          raise ArgumentError, &quot;:#{option} must be a number, a symbol or a proc&quot; unless value.is_a?(Numeric) || value.is_a?(Proc) || value.is_a?(Symbol)
         end
 
         validates_each(attr_names,configuration) do |record, attr_name, value|
@@ -74,6 +90,9 @@ module ActiveModel
                 record.errors.add(attr_name, option, :value =&gt; raw_value, :default =&gt; configuration[:message])
               end
             else
+              configuration[option] = configuration[option].call(record)        if configuration[option].is_a? Proc
+              configuration[option] = record.method(configuration[option]).call if configuration[option].is_a? Symbol
+              
               unless raw_value.method(ALL_NUMERICALITY_CHECKS[option])[configuration[option]]
                 record.errors.add(attr_name, option, :default =&gt; configuration[:message], :value =&gt; raw_value, :count =&gt; configuration[option])
               end</diff>
      <filename>activemodel/lib/active_model/validations/numericality.rb</filename>
    </modified>
    <modified>
      <diff>@@ -106,6 +106,24 @@ class NumericalityValidationTest &lt; ActiveModel::TestCase
     valid!([2])
   end
 
+  def test_validates_numericality_with_proc
+    Topic.send(:define_method, :min_approved, lambda { 5 })
+    Topic.validates_numericality_of :approved, :greater_than_or_equal_to =&gt; Proc.new {|topic| topic.min_approved }
+
+    invalid!([3, 4])
+    valid!([5, 6])
+    Topic.send(:remove_method, :min_approved)
+  end
+
+  def test_validates_numericality_with_symbol
+    Topic.send(:define_method, :max_approved, lambda { 5 })
+    Topic.validates_numericality_of :approved, :less_than_or_equal_to =&gt; :max_approved
+
+    invalid!([6])
+    valid!([4, 5])
+    Topic.send(:remove_method, :max_approved)
+  end
+
   def test_validates_numericality_with_numeric_message
     Topic.validates_numericality_of :approved, :less_than =&gt; 4, :message =&gt; &quot;smaller than {{count}}&quot;
     topic = Topic.new(&quot;title&quot; =&gt; &quot;numeric test&quot;, &quot;approved&quot; =&gt; 10)</diff>
      <filename>activemodel/test/cases/validations/numericality_validation_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7e3abbfdc2087e397816f2b81b739558c064c576</id>
    </parent>
  </parents>
  <author>
    <name>Kane</name>
    <login>Kanetontli</login>
    <email>kane@raktefakt.net</email>
  </author>
  <url>http://github.com/rails/rails/commit/cf9f361699d72b5b34a655f8940c024cba0f0e09</url>
  <id>cf9f361699d72b5b34a655f8940c024cba0f0e09</id>
  <committed-date>2009-08-31T11:35:14-07:00</committed-date>
  <authored-date>2009-08-31T11:34:46-07:00</authored-date>
  <message>added proc and symbol support to validates_numericality_of [#3049 state:resolved]

Signed-off-by: Joshua Peek &lt;josh@joshpeek.com&gt;</message>
  <tree>e2495cb3a2677063449b60ee37ace2c9b0bbf61b</tree>
  <committer>
    <name>Joshua Peek</name>
    <login>josh</login>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
