One of the coolest thing in Rails 3 is notifications. But I would like to ask if there is a list of all notifications names that I can subscribe to?
I couldn't find it in documentation (only few examples), so I can only go to the code if I don't find the answer here.
This seems like a comprehensive list
http://edgeguides.rubyonrails.org/active_support_instrumentation.html#render_partial- action_view
I was looking for the exact same thing. It seems there's no documentation on this, so I browsed the code and compiled the following list.
Note that the ===
operator is used for matching, so you can use a string or a regex when subscribing
receive.action_mailer
deliver.action_mailer
write_fragment.action_controller
read_fragment.action_controller
exist_fragment?.action_controller
expire_fragment.action_controller
expire_page.action_controller
write_page.action_controller
start_processing.action_controller
process_action.action_controller
send_file.action_controller
send_data.action_controller
redirect_to.action_controller
halted_callback.action_controller
render_collection.action_view
render_partial.action_view
render_template.action_view
!render_template.action_view
sql.active_record
cache_read.active_support
cache_fetch_hit.active_support
cache_generate.active_support
cache_write.active_support
cache_delete.active_support
cache_exist?.active_support
deprecation.rails
render
config/initializers/notifications.rb
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload|
PageRequest.create! do |page_request|
page_request.path = payload[:path]
page_request.page_duration = (finish - start) * 1000
page_request.view_duration = payload[:view_runtime]
page_request.db_duration = payload[:db_runtime]
end
end
more info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With