lib/notifiably_audited/helper.rb in notifiably_audited-1.0.4 vs lib/notifiably_audited/helper.rb in notifiably_audited-1.0.5
- old
+ new
@@ -1,8 +1,22 @@
module NotifiablyAudited
module NotifiablyAuditedHelpers
- def notifiably_audited(a)
- a
+ 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
end
end