Timo Springmann
2007-May-10 14:42 UTC
Observers not working because of AR Plugins? (Rails = 1.2.3)
Hi list, I''ve tried to implement a simple Observer to log changes to my objects. Whenever I try to enable the observer in my environment.rb, my application refuses to start. Here''s what''s in my environment.rb: Rails::Initializer.run do |config| config.active_record.observers = :audit_observer end It seems, that rails can''t find the plugins used in the observed models. This was a problem in older rails version (see http://dev.rubyonrails.org/changeset/4684), but I''m using rails 1.2.3, so this is already included. As nearly all my models ar using some plugins, what can I do to get observers working? Here''s the mongrel output: => Booting Mongrel (use ''script/server webrick'' to force WEBrick) => Rails application starting on http://0.0.0.0:3005 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3005 ** Starting Rails with development environment... Exiting /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1235:in `method_missing'': undefined method `acts_as_timeable'' for Client:Class (NoMethodError) from ./script/../config/../app/models/client.rb:3 from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_file'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:202:in `load_file'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:94:in `require_or_load_without_engine_additions'' from ./script/../config/../vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:139:in `require_or_load'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:248:in `load_missing_constant'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'' ... 38 levels... from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'' from /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' from script/server:3 Regards, Timo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Timo Springmann
2007-May-10 14:59 UTC
Re: Observers not working because of AR Plugins? (Rails = 1.2.3)
ok, I was looking into the wrong version of environment.rb. It looks like this: Rails::Initializer.run do |config| config.plugins = ["engines", "*"] config.active_record.observers = :audit_observer end I really wonder, why config.plugins = ["engines", "*"] is causing the error? Shouldn''t all plugins get loaded before the observer gets activated? When I put all plugins into that config.plugins Array, it seems to work. So, why does "*" does not work? Regards, Timo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---