Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // View
  2. <script src="https://js.pusher.com/2.2/pusher.min.js"></script>
  3. <script>
  4. $(document).on('page:fetch', function() {
  5. pusher.disconnect();
  6. });
  7. </script>
  8. <script>
  9. var pusher = new Pusher('<%= Pusher.key %>', {
  10. encrypted: true,
  11. cluster: 'eu'
  12. });
  13. var channel = pusher.subscribe('test_channel');
  14. channel.bind('greet', function(data) {
  15. $("#print").load(location.href + " #print");
  16. });
  17. </script>
  18.  
  19. //controller
  20. def update
  21. @worker = Worker.find(params[:id])
  22. if @worker.update(worker_params)
  23. redirect_to main_path
  24. Pusher['test_channel'].trigger('greet', { :greeting => "#present" })
  25. else
  26. render 'edit'
  27. end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement