Daniel Waite
2006-Aug-16 20:26 UTC
[Rails] Active Record Observers causing 404''s and other weird issues
Hi all. I''ve got a simple AR Observer:
class NewOrderObserver < ActiveRecord::Observer
observe NewOrder
def after_create(object)
Note.create(...)
end
end
In environment.rb I have the following line:
config.active_record.observers = :new_order_observer
And in application.rb I have:
NewOrderObserver.instance
Aside from simply not working, it''s causing 404''s and telling
me that
certain methods are suddenly no longer available. If I remove those
three bits of code, everything works fine.
Any ideas? Am I even doing things right? The documentation for observers
is so sparse.
--
Posted via http://www.ruby-forum.com/.
Daniel Waite
2006-Aug-16 20:55 UTC
[Rails] Re: Active Record Observers causing 404''s and other weird is
Ah, nevermind. I''ve got it. It was inside the Note.create that I was saying: :notable_type => object.class It should be: :notable_type => object.class.to_s -- Posted via http://www.ruby-forum.com/.