<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 == master
 
+* Fix limits for integer columns being interpreted incorrectly [Michael Grosser]
+
 == 0.1.0 / 2008-12-14
 
 * Remove the PluginAWeek namespace
@@ -8,8 +10,8 @@
 == 0.0.2 / 2008-06-22
 
 * Remove log files from gems
-* Don't check length validation constraints if models were loaded prior to the plugin being loaded [grosser]
-* Refactor FormHelper extension to allow for others to easily extend the plugin for things like textarea lengths [grosser]
+* Don't check length validation constraints if models were loaded prior to the plugin being loaded [Michael Grosser]
+* Refactor FormHelper extension to allow for others to easily extend the plugin for things like textarea lengths [Michael Grosser]
 * Add support for tracking validates_size_of validations
 
 == 0.0.1 / 2008-05-05</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -42,8 +42,15 @@ module SmartFieldConstraints
         
         # Finds the maximum length according to column limits
         def column_limit
-          if column = object.class.columns_hash[method_name]
-            column.limit
+          column = object.class.columns_hash[method_name]
+          
+          if column &amp;&amp; limit = column.limit
+            if column.text?
+              limit
+            elsif column.number?
+              # Length is bound by the upper limit of the number + 1 (for negatives)
+              Math.log10(2 ** (limit * 8 - 1)).ceil + 1
+            end
           end
         end
     end</diff>
      <filename>lib/smart_field_constraints/extensions/form_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 class CreateUsers &lt; ActiveRecord::Migration
   def self.up
-    create_table :users do |t|
+    create_table :users, :id =&gt; false do |t|
+      t.integer :id, :limit =&gt; 4, :null =&gt; false # For limit for testing purposes
       t.string :login, :limit =&gt; 12
       t.string :password, :limit =&gt; 16
       t.text :biography</diff>
      <filename>test/app_root/db/migrate/001_create_users.rb</filename>
    </modified>
    <modified>
      <diff>@@ -57,7 +57,7 @@ class FormHelperWithValidationConstraintsTest &lt; ActionView::TestCase
   end
 end
 
-class FormHelperWithColumnConstraintsTest &lt; ActionView::TestCase
+class FormHelperWithStringColumnConstraintsTest &lt; ActionView::TestCase
   tests ActionView::Helpers::FormHelper
   
   def setup
@@ -85,6 +85,18 @@ class FormHelperWithColumnConstraintsTest &lt; ActionView::TestCase
   end
 end
 
+class FormHelperWithNumberColumnConstraintsTest &lt; ActionView::TestCase
+  tests ActionView::Helpers::FormHelper
+  
+  def setup
+    @user = User.new
+  end
+  
+  def test_should_add_maxlength
+    assert_equal '&lt;input id=&quot;user_id&quot; maxlength=&quot;11&quot; name=&quot;user[id]&quot; size=&quot;30&quot; type=&quot;text&quot; /&gt;', text_field(:user, :id)
+  end
+end
+
 class FormHelperForModelNotTrackedTest &lt; ActionView::TestCase
   tests ActionView::Helpers::FormHelper
   </diff>
      <filename>test/helpers/form_helper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8708aafc2a8e242b90ef42207167c3dc3714e6f1</id>
    </parent>
  </parents>
  <author>
    <name>Aaron Pfeifer</name>
    <email>aaron.pfeifer@gmail.com</email>
  </author>
  <url>http://github.com/pluginaweek/smart_field_constraints/commit/4a8b5dccac31413b437a5050a66ecb40a1d12b90</url>
  <id>4a8b5dccac31413b437a5050a66ecb40a1d12b90</id>
  <committed-date>2009-03-15T13:23:50-07:00</committed-date>
  <authored-date>2009-03-15T13:23:50-07:00</authored-date>
  <message>Fix limits for integer columns being interpreted incorrectly</message>
  <tree>d3068e983111a41bc05cd354ea75a32301fa8046</tree>
  <committer>
    <name>Aaron Pfeifer</name>
    <email>aaron.pfeifer@gmail.com</email>
  </committer>
</commit>
