Hello all,

I've just generated a migration with a very long and descriptive name, weighing in at 78 characters. Unfortunately this class name causes Rails to generate an exception because it blindly subtracts 75 from the length of the string in the announce method of Migration. This raises an exception like the following:

rake aborted!
negative argument
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/ active_record/migration.rb:247:in `*' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/ active_record/migration.rb:247:in `announce' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/ active_record/migration.rb:205:in `migrate'

Attached is a very small patch which updates the logic to check for negative values and return 0 if the subtracted length is negative. This will migration names of any length to be executed properly. It should be very low risk to apply, unless I'm missing something.

Cheers,
Blake Watters
Near-Time, Inc.
http://www.near-time.com/


Attachment: long_migration_names_fix.diff
Description: Binary data

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to