This project is archived and is in readonly mode.

#6068 ✓resolved
Samuel Kadolph

Reloading in the console stops observer callbacks

Reported by Samuel Kadolph | November 25th, 2010 @ 09:06 PM

Calling reload! in the console stops all observer callbacks from being fired on new instances of records (old records in memory still work).

class GizmoObserver < ActiveRecord::Observer
  def after_save(gizmo)
    puts "after_save(#{gizmo})"
  end
end

And now in a console:

$ rails c
Loading development environment (Rails 3.0.3)
ruby-1.9.2-p0 > (g = Gizmo.first).save
after_save(#<Gizmo:0xa59df94>)
 => true
ruby-1.9.2-p0 > reload!
Reloading...
 => true
ruby-1.9.2-p0 > Gizmo.first.save
 => true
ruby-1.9.2-p0 > g.save
after_save(#<Gizmo:0xab806b4>)
 => true

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>

Pages