This project is archived and is in readonly mode.
Adds an :on option to ActiveRecord observers
-
Bryan Liles
The would read much better if you could do:
observe :comment, :photo, :after => :create
-or-
observe :comment, :photo, :on => [:create, :update]
-
Gabriel Gironda
Thanks for the comments, Bryan!
The former, I agree with. When I get a moment I'll add that functionality to the patch.
The latter would be a problem because there's cases where you might want
before_updaterather thanafter_update. Defaulting it to useafter_by convention would cause problems in the case where a custom callback is being used -notify(:before_some_domain_specific_event)in your models, for example. -
Gabriel Gironda
Here's a new patch that adds the :after => :create kind of syntax.
-
CancelProfileIsBroken
- Tag changed from patch to bugmash, patch
-
Dan Pickett
+1 this is nice syntax
having trouble applying the patch - will try to apply to master and modify as necessary
-
Rizwan Reza
- Milestone cleared.
- Tag changed from bugmash, patch to activerecord, observers, patch
- State changed from new to open
- Assigned user set to Pratik
