This project is archived and is in readonly mode.

#4994 ✓resolved
petRUShka

Rails3: observer in config/application.rb brokes rake db:migrate

Reported by petRUShka | June 28th, 2010 @ 12:38 PM | in 3.0.2

user@linux-equf:~/proj/my_app> rake db:migrate --trace
(in /home/user/proj/my_app)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
No attribute named `status` exists for table `orders`
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/predicate_builder.rb:24:in `build_from_hash'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/query_methods.rb:216:in `map'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/predicate_builder.rb:9:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/predicate_builder.rb:9:in `map'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/predicate_builder.rb:9:in `build_from_hash'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/query_methods.rb:216:in `build_where'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/relation/query_methods.rb:42:in `where'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:405:in `__send__'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:405:in `where'
/home/user/proj/my_app/app/models/order.rb:32
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:418:in `load'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:418:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:554:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:417:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:313:in `require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:455:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:156:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:154:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:154:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.11/lib/rspec/core/backward_compatibility.rb:26:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.0.beta.11/lib/rspec/expectations/backward_compatibility.rb:6:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/inflector/methods.rb:103:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/inflector/methods.rb:102:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/inflector/methods.rb:102:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/core_ext/string/conversions.rb:59:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:177:in `observed_class'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:170:in `observed_classes'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:190:in `observed_classes'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:186:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/observer.rb:94:in `initialize'
/usr/lib/ruby/1.8/singleton.rb:94:in `new'
/usr/lib/ruby/1.8/singleton.rb:94:in `instance'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:64:in `instantiate_observer'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:37:in `instantiate_observers'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:37:in `each'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta4/lib/active_model/observing.rb:37:in `instantiate_observers'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/railtie.rb:80
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:17:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:17:in `execute_hook'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:7:in `on_load'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/railtie.rb:79
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:15:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:15:in `execute_hook'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:24:in `run_load_hooks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:23:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:23:in `run_load_hooks'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application/finisher.rb:46
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb:25:in `instance_exec'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb:25:in `run'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb:55:in `run_initializers'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb:54:in `each'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/initializable.rb:54:in `run_initializers'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb:119:in `initialize!'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb:81:in `send'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb:81:in `method_missing'
/home/user/proj/my_app/config/environment.rb:5
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:212:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:212:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:198:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:554:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:198:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/dependencies.rb:212:in `require'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb:94:in `require_environment!'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta4/lib/rails/application.rb:192:in `initialize_tasks'
/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:607:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596: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/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: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

order.rb, line 32:

scope :old, where(:status => "old")

But if i comment this config line:

config.active_record.observers = :order_observer

rake db:migrate works fine.

Rails3.beta4
ruby 1.8.7 (2008-08-11 patchlevel 72) [i586-linux]

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages