27 Jul '12, 5pm
Chaque jour j'ai de nouvelles raisons d'aimer Rails : aujourd'hui, découverte des notifications ! *.* #RoR #RailsCasts
We’ll implement this by using a feature that was introduced in Rails 3: ActiveSupport::Notifications . We can use notifications to create instruments. An instrument takes a block of code and when the block finishes executing it will send out a notification event. Any notifications that are subscribed to this event will then be triggered. A typical request in a Rails 3 application sends out several of these notifications and we can subscribe to any of them. Before we write our own instrument let’s try subscribing to some of the built-in ones to get a feel for how they work.