This project is archived and is in readonly mode.

#3850 ✓invalid
sad sheep

Observers and Rails 2.3.5

Reported by sad sheep | February 4th, 2010 @ 03:55 PM

Hello there guys,
i'm facing a strange problem using Observers with Rails 2.3.5.

1) I generated a new observer using builtin generator
2) I added observer into environment.rb (config.active_record.observers = [:project])

Observer content
class ProjectObserver < ActiveRecord::Observer
def after_create(project)

#

end end

Rails 2.3.5 crashes at startup, with following message
=> Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1959:in method_missing': undefined methodinstance' for #<Class:0x1034416d8> (NoMethodError)

from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:38:in `instantiate_observers'
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:36:in `each'
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:36:in `instantiate_observers'
from /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:15:in `define_dispatcher_callbacks'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call'

[...]

Rails 2.3.4 boots without problems.

How can i help you to get this fixed?
Need other informations?

Thanks.

Comments and changes to this ticket

  • Matt Jones

    Matt Jones February 4th, 2010 @ 09:05 PM

    Not sure how this was working in 2.3.4, but your syntax is incorrect: :project in config.active_record.observers should be :project_observer.

  • sad sheep

    sad sheep February 5th, 2010 @ 08:46 AM

    Sorry for my mistake :(

    Rails 2.3.5 works with your syntax.

    I suggest to change into environment.rb the following commented lines then:

    Activate observers that should always be running

    config.active_record.observers = :cacher, :garbage_collector, :forum_observer

    Thanks and keep up the good work!

    m.

  • Matt Jones

    Matt Jones February 7th, 2010 @ 09:36 PM

    • State changed from “new” to “invalid”

    I'm unsure what your comment above is supposed to mean - there's no magic applied to the names of the observers, so what you put in the config statement is what you get.

    Closing for now.

  • Ryan Bigg

    Ryan Bigg October 9th, 2010 @ 09:44 PM

    • Tag cleared.
    • Importance changed from “” to “Low”

    Automatic cleanup of spam.

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>

Pages