I'm just trying to run a migration, but I'm getting the following stacktrace (below).
I'm using rails 2.3.8 and desert 0.5.4.
rake aborted!
undefined method `abstract_class?' for Object:Class
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2242:in `class_of_active_record_descendant'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1492:in `base_class'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1164:in `reset_table_name'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1160:in `table_name'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:3154:in `quoted_table_name'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2261:in `sanitize_sql'
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:24:in `send'
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:24:in `initialize_schema_migrations_table'
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:23:in `each'
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:23:in `initialize_schema_migrations_table'
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:12:in `each'
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:12:in `initialize_schema_migrations_table'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:441:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in `new'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in `up'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:383:in `migrate'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:112
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/lib/ruby/gems/1.8/gems/rak开发者_如何学运维e-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
The bug appears to be in the desert gem on the following line:
/usr/lib/ruby/gems/1.8/gems/desert-0.5.4/lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb:24
which turns out to be:
insert_sql = ActiveRecord::Base.send(:sanitize_sql, [ "INSERT INTO...
Any ideas for fixing this?
I've got a hack that gets around it, but it's ugly:
class Object
# ActiveRecord::Base *is* an abstract class.
unless defined?(abstract_class?)
def abstract_class?
true
end
end
end
精彩评论