Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // View
- <script src="https://js.pusher.com/2.2/pusher.min.js"></script>
- <script>
- $(document).on('page:fetch', function() {
- pusher.disconnect();
- });
- </script>
- <script>
- var pusher = new Pusher('<%= Pusher.key %>', {
- encrypted: true,
- cluster: 'eu'
- });
- var channel = pusher.subscribe('test_channel');
- channel.bind('greet', function(data) {
- $("#print").load(location.href + " #print");
- });
- </script>
- //controller
- def update
- @worker = Worker.find(params[:id])
- if @worker.update(worker_params)
- redirect_to main_path
- Pusher['test_channel'].trigger('greet', { :greeting => "#present" })
- else
- render 'edit'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement