Proposing a patch from 2.2.x to be applied to earlier versions


I stumbled upon an issue with migrations that's trivially fixable, and has already been fixed in 2.2 (commit def594b92d1...) - But I'd love to see it applied in a 2.1 (maybe 2.0?) point release. I am lost on what to do to propose the fix, as it does not warrant IMHO opening a lighthouse bug, setting up a test case and all that... It would be enough to add the patch to the 2.1/2.0 branches.

The (again, trivial) patch describes the problem and the fix:

diff --git a/activerecord/lib/active_record/connection_adapters/ abstract/schema_statements.rb b/activerecord/lib/active_record/ connection_adapters/abstract/schema_statements.rb index 67d70b3..d943e6c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/ schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/ schema_statements.rb @@ -345,7 +345,7 @@ module ActiveRecord

       def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:          if native = native_database_types[type] - column_type_sql = native.is_a?(Hash) ? native[:name] : native + column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup

           if type == :decimal # ignore limit, use precision and scale              scale ||= native[:scale]

The problem is that each time type_to_sql is called, it acted upon the field definition itself, without copying it beforehand. I ended up with (obviously invalid) SQL attempting to define a field as varying (255)(255)(255)(255).

Again, this patch has already been applied (June 9, 2008) to Rails 2.2. Could it be added as a reliability fix to further point revisions of older versions?

Cherry-picked back to 2-1-stable: and 2-0-stable:

Thanks! jeremy