2012-04-02 15 views
6

रेल 3 में सबसे अच्छी चीज में से एक अधिसूचनाएं हैं। लेकिन मैं यह पूछना चाहूंगा कि क्या सभी अधिसूचना नामों की एक सूची है जिसे मैं सब्सक्राइब कर सकता हूं?रेल 3 मानक अधिसूचना सूची

मुझे इसे दस्तावेज (केवल कुछ उदाहरण) में नहीं मिला, इसलिए अगर मुझे यहां जवाब नहीं मिलता है तो मैं केवल कोड पर जा सकता हूं।

उत्तर

1

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 

अधिक जानकारी here

+0

लेकिन सदस्यता लेने के एक स्ट्रिंग या एक regex उपयोग कर सकते हैं, मिलान के लिए प्रयोग किया जाता है वहाँ केवल कुछ उदाहरण हैं, मैं जो पूछना चाहता हूं वह उपलब्ध अधिसूचनाओं की पूरी सूची है –

+0

@Said, क्या आप http://stackoverflow.com/questions/146650 के बारे में कुछ बता सकते हैं 16/रेल-सक्रिय-समर्थन-नोटिफिकेशन-गलत-डीबी-रनटाइम-मान? – Fivell

4

मैं सटीक एक ही बात के लिए देख रहा था। ऐसा लगता है कि इस पर कोई दस्तावेज नहीं है, इसलिए मैंने कोड ब्राउज़ किया और निम्न सूची संकलित की।

ध्यान दें कि === ऑपरेटर ताकि आप जब

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 
+0

इस –

संबंधित मुद्दे