Module: NotifiablyAudited::NotifiablyAuditedHelpers

Defined in:
lib/notifiably_audited/helper.rb

Instance Method Summary collapse

Instance Method Details

#notifiably_audited(script) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/notifiably_audited/helper.rb', line 3

def notifiably_audited(script)
  user_id = current_user.id rescue nil
    
  html = '<script>    
  
  PrivatePub.subscribe("/notifiably_audited/'
  
  html += user_id.to_s 
  
  html += '", function(data, channel) {'
  
  html += script
  
  html += '});</script>'
  
  html += subscribe_to "/notifiably_audited/#{user_id}"
end