cremes.devlist@mac.com
2006-Jun-23 19:14 UTC
[Rails] help... can''t run ActiveRecord unit tests to test bug fix
I found a bug in ActiveRecord. Being a good netizen, I thought I would write a test to illustrate the bug, fix it, and then submit a patch to the maintainers. However, I can''t run the AR tests. I followed the instructions in RUNNING_UNIT_TESTS but it generates an error immediately /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/test cremes$ ruby -I "connections/native_mysql" active_schema_mysql.rb ./../lib/active_record/base.rb:246: undefined method `cattr_accessor'' for ActiveRecord::Base:Class (NoMethodError) from /opt/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in `require'' from ./../lib/active_record.rb:37 from ./abstract_unit.rb:5 from active_schema_mysql.rb:1 It can''t seem to find the definition for #cattr_accessor which is defined in the activesupport gem. This is Rails 1.1.2 comprised of AR 1.14.2, ActiveSupport 1.3.1, etc. running on OSX 10.4.6 & Ruby 1.8.4 from darwinports. Any ideas how to get this working? BTW, the bug in AR is in the #add_column/#drop_column methods. Currently it isn''t handling reserved words correctly if one is used as a column name. Example Migration: self.up drop_column :some_table, :condition end MySQL allows the use of reserved words as column names provided they are quoted using the backtick. This is actually handled properly elsewhere in AR via the #quote_column_name method (in mysql_adapter.rb), but this method isn''t used in #add_column or #drop_column. cr